我想对文件的每一行进行一些处理。
for /f "delims=" %%i in ("%RF_PROPERTIES%") do (
echo %%i
)
我的 RF_PROPERTIES 指向带空格的文件路径 (c:\program files\Arcot systems\conf\rf.properties)。它提示说环境变量 C:\Program Files\Arcot 未定义,即使我提供了引号。如何让它工作?
最佳答案
尝试添加 usebackq
选项:
for /f "usebackq delims=" %%i in ("%RF_PROPERTIES%") do (
echo %%i
)
for /?
输出的解释:usebackq - specifies that the new semantics are in force, where a back quoted string is executed as a command and a single quoted string is a literal string command and allows the use of double quotes to quote file names in file-set.
关于file - 用于/f 处理带空格的文件名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5006290/