Windows batch FOR loop on range through command line

后端 未结 2 481
被撕碎了的回忆
被撕碎了的回忆 2020-12-29 04:52

I want to perform an operation multiple times from a command window. Common sense tells me that a FOR loop should be able to handle this. Sure enough, if I want to execute,

相关标签:
2条回答
  • 2020-12-29 05:25

    for /l %%i in (1,1,100) do echo %%i

    add another % sign before i to work

    0 讨论(0)
  • 2020-12-29 05:27

    You can use the /l tag in your statement to make it loop through a set of numbers.

    eg.

    C:\> FOR /l %i in (1,1,1000) DO myProg.exe

    This says loop through the range, starting at 1, stepping 1 at a time, until 1000

    http://ss64.com/nt/for_l.html

    0 讨论(0)
提交回复
热议问题