For循环批处理文件中的错误:不要在这个时候意外 [英] For loop in batch file error: Do was unexpected at this time

查看:396
本文介绍了For循环批处理文件中的错误:不要在这个时候意外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to execute following command using batch file:

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)

它可以在自己的被调用的命令提示符时,但只要我将它保存在批处理文件中失败的消息

It works when being invoked on its own in command prompt but as soon as I would save it within batch file it fails with the message

做的是意想不到的,此时

Do was unexpected at this time

任何想法?

推荐答案

在批量使用 %%我,而在命令行中使用%I

in batch use %%i, whereas in command line use %i

这篇关于For循环批处理文件中的错误:不要在这个时候意外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆