我正在尝试通过批处理文件在txt文件的所有行上运行命令。我正在努力逃避for循环的IN()子句中的字符。
这有效:
for /F %%i IN (C:\test.txt) DO echo %%i
这些不是:
for /F %%i IN (C:\Documents and Settings\user\Desktop\test.txt) DO echo %%i
for /F %%i IN ("C:\Documents and Settings\user\Desktop\test.txt") DO echo %%i
for /F %%i IN ('C:\Documents and Settings\user\Desktop\test.txt') DO echo %%i
知道如何让cmd注册完整路径吗?谢谢 -
乔纳森
答案 0 :(得分:0)
尝试for command的usebackq
选项。
for /F usebackq %%i IN ('C:\Documents and Settings\user\Desktop\test.txt') DO echo %%i