为什么FOR loop命令在Windows命令提示符下可以工作的批处理文件中不起作用? [英] Why does FOR loop command not work in a batch file which works on Windows command prompt?
本文介绍了为什么FOR loop命令在Windows命令提示符下可以工作的批处理文件中不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
FOR /L %A IN (1,1,100) DO echo %A
批处理脚本中的上述代码导致此错误:
The code above in a batch script results in this error:
这一次出乎意料.
A was unexpected at this time.
同一命令行在Windows命令提示符下工作正常.
The same command line works fine on Windows command prompt.
出什么问题了?
推荐答案
您需要使用双精度字符:
You need to use double percent characters:
FOR /L %%A IN (1,1,100) DO echo %%A
这篇关于为什么FOR loop命令在Windows命令提示符下可以工作的批处理文件中不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文