gpt4 book ai didi

batch-file - 批处理文件 : FOR/F doesn't work if path has spaces

转载 作者:行者123 更新时间:2023-12-03 21:05:09 26 4
gpt4 key购买 nike

这是我遇到的问题:

@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在程序名称之前:

FOR /F "usebackq" %%A IN (`CALL "C:\Folder With Spaces\command.exe" "C:\File Being Passed as a Parameter.txt"`) DO ECHO %%A

关于batch-file - 批处理文件 : FOR/F doesn't work if path has spaces,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6474738/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com