【问题标题】:For loop in batch file error: Do was unexpected at this time批处理文件中的for循环错误:此时Do是意外的
【发布时间】:2013-07-18 14:16:02
【问题描述】:

我正在尝试使用批处理文件执行以下命令:

for /f %i in (D:\random\servers.txt) DO (d:\utils\tail -60 \\%i\c$\Windows\windowsUpdate.log | d:\utils\grep "updates detected" & set tx1234=%i)

它在命令提示符下单独调用时有效,但一旦我将它保存在批处理文件中,它就会失败并显示消息

此时做的出乎意料

有什么想法吗?

【问题讨论】:

  • 批量使用%%i,命令行使用%i
  • @kayasax,你的评论就是我要投票的答案。
  • @PA 回答了,谢谢

标签: batch-file


【解决方案1】:

批量使用%%i,而命令行使用%i

【讨论】:

  • 答案是正确的,但是为什么这是不同的解释,或者至少是什么不同的定义导致批处理和命令行之间出现这种情况?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-04-08
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多