3

有人可以解释我的 for 语句有什么问题吗?我正在尝试将其作为 bat 文件运行。我在网上查看了各种示例,但似乎无法弄清楚为什么会出现语法错误

FOR /F "tokens=*" %%A in (c:\scripts\destination.txt) DO 
(
echo inside the for loop
pause
)

我收到以下错误:

该命令的语法不正确。C:\Scripts>FOR /F "tokens=*" %A in (c:\scripts\destination.txt) DO

4

1 回答 1

6

括号必须在同一行。

tokens=*删除前导空格 -delims=没有。

FOR /F "delims=" %%A in (c:\scripts\destination.txt) DO (
echo %%A - inside the for loop
pause
)
于 2013-10-09T08:06:05.200 回答