【发布时间】:2013-06-21 21:43:38
【问题描述】:
我有一个文件夹,其中包含未知数量的 .txt 文件,名称如下:
todo.txt
todo (1).txt
todo (2).txt
todo (3).txt
我正在运行这个命令来遍历文件并在文件中的每一行打印文本:for /r %f in (test\*.txt) do (for /f %p in (%f) do echo %p)
/r 正确返回文件名,/f 将输出 todo.txt 中的每一行文本,但是当它点击 todo (1).txt 时,它会执行命令 for /f %p in (C:\test\todo (1).txt) do echo %p 并错误输出 The system cannot find the file C:\test\todo.
在这种情况下如何转义括号?
【问题讨论】:
标签: windows command-line batch-file command-prompt