gpt4 book ai didi

file - 用于/f 处理带空格的文件名

转载 作者:行者123 更新时间:2023-12-03 14:46:01 24 4
gpt4 key购买 nike

我想对文件的每一行进行一些处理。

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/

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