這是我遇到的問題:批處理文件:因爲如果路徑中有空格/ F不起作用
@ECHO OFF
REM If this batch file is run in the same directory as "command.exe" then the
REM following line will work.
FOR /F "usebackq" %%A IN (`command.exe "C:\File Being Passed as a Parameter.txt"`) DO ECHO %%A
REM The following line does not work no matter where this batch file is run.
FOR /F "usebackq" %%A IN (`"C:\Folder With Spaces\command.exe" "C:\File Being Passed as a Parameter.txt"`) DO ECHO %%A
我想用來存儲該批處理文件的地方我想,而不是被迫店它位於與command.exe相同的文件夾中。有什麼建議麼?
爲什麼使用'call'有EXE? – jeb
@jeb:在這種特殊情況下,解決相關問題。 –
你是對的,我測試了它,似乎只有'調用'的方式工作 – jeb