包含变量的文件名和目录正在内部过程中进行评估。如何在不评估的情况下将文件名批量存储为变量?
EG:我的路径是:
"C:\Rare\Names in a File\%CD%\"
batchfile.bat
file.txt
我想在这个目录中运行一个脚本:
REM #####BATCHFILE.BAT#######
pushd "%dp0"
for %%A in ("C:\Test") do set EXEPATH=%%~A
for %%A in ("Test.exe") do set EXECUTABLE=%%~A
for %%A in ("%CD%") do set DIRNAME=%%~A
for %%A in ('dir /b /a-d "*.txt"') do (
SET FILENAME=%%~A
CALL :PROCEDURE
)
exit /b
:PROCEDURE
start /w "" "%EXEPATH%\%EXECUTABLE%" "%DIRNAME%\%FILENAME%"