echo off setlocal enabledelayedexpansion set "EXCEL_DIR=%cd%excel" for /R %EXCEL_DIR% %%f in (*.xls) do ( set "FILE_PATH=%%f" echo 完整的路径: !FILE_PATH! set "FILE_DIR=%%~dpf" echo 所在的目录: !FILE_DIR! set "FILE_NAME=%%~nf" echo 简略文件名: !FILE_NAME! set "FILE_EXT=%%~xf" echo 文件后缀名: !FILE_EXT! set "FILE_FULLNAME=%%~nxf" echo 完整文件名: !FILE_FULLNAME! set "FILE_PATH_NO_EXT=%%~dpnf" echo 无后缀路径: !FILE_PATH_NO_EXT! ) pause