嵌套对于批处理文件错误循环:做的就是意外在这个时候 [英] nested For loop in batch file error: Do was unexpected at this time

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

问题描述

我是新来编写批处理文件。我试图做到以下几点。

I am new to writing batch files. I am trying to do the following .

读线从文件调用LIST.TXT有这些空间分隔两个记号和下一个for循环我正在令牌化和发送这些令牌作为参数传递给另一个脚本行。

Read line by line from file called list.txt which has two tokens which are space seperated and in the next for loop i am tokenizing and sending these tokens as parameters to another script.

FOR /F %%i IN (C:\list.txt) DO

FOR /F "tokens=1,2 delims= " %%A IN (%%i) DO   
winscp.com /script=C:\myscript1.txt /parameter %%A  C:\%%B

不过,我收到以下错误。不要被联合国预计在这个时候。

But I am getting the following error. Do was un expected at this time.

有人能解释我错过了什么。

Can some one explain what am I missing.

感谢

推荐答案

独立于已经解决了的问题,您可以实现在同一个令牌分离为读取文件。此外,对于命令有空格默认分隔符,所以 delims =是不需要的,即:

Independently of the already solved problem, you may achieve the token separation in the same FOR that read the file. Also, FOR command have spaces as default separators, so delims= " is not needed. That is:

FOR /F "tokens=1,2" %%A IN (C:\list.txt) DO  (
   winscp.com /script=C:\myscript1.txt /parameter %%A  C:\%%B
)

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

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