我试图运行一个简单的batch file。
for /f %%a IN ('dir /b /s "%~dp0\EnsembleIndependant\*.mis"') DO (ECHO %%a >> ResultatVorace.txt & CALL vorace.exe -f %%a >> ResultatVorace.txt)
这只适用于batch file的path中没有空格的情况。
该批次在:
C:\ Users \ Rafael \ Documents \ Visual Studio 2012 \ Projects \ vorace \ Release \ vorace.exe
我想要循环的文件在:
C:\ Users \ Rafael \ Documents \ Visual Studio 2012 \ Projects \ vorace \ Release \ EnsembleIndependant
谁能帮我。
谢谢。
谢谢你们的build议。 for / f“delims =”解决了我的问题。
for /f "delims=" %%a IN ('dir /b /s "%~dp0EnsembleIndependant\*.mis"') DO (ECHO %%a >> ResultatVorace.txt & CALL vorace.exe -f %%a >> ResultatVorace.txt)
%~dp0
已经在最后退格了。
for /f "delims=" %%a IN ('dir /b /s "%~dp0\EnsembleIndependant\*.mis"') DO (ECHO %%a >> ResultatVorace.txt & CALL vorace.exe -f %%a >> ResultatVorace.txt)
空格是循环的批处理标准分隔符, <tab>
和"delims="
停用的。
FOR / F用作标准分隔符的space
和tab
符,为了避免这种情况,你需要添加选项。
for /f "delims=" %%a IN ('dir /b /s "%~dp0\EnsembleIndependant\*.mis"') DO (ECHO %%a >> ResultatVorace.txt & CALL vorace.exe -f %%a >> ResultatVorace.txt)