How to increment variable under DOS?

前端 未结 9 1647
清酒与你
清酒与你 2021-02-06 21:36

I\'ve spent the past 3hrs trying to work this out but just couldn\'t find a solution. Here\'s my batch script:

if NOT Exist Counter.txt GOTO START
Type c:\\count         


        
9条回答
  •  遥遥无期
    2021-02-06 22:24

    Coming to the party very very late, but from my old memory of DOS batch files, you can keep adding a character to the string each loop then look for a string of that many of that character. for 250 iterations, you either have a very long "cycles" string, or you have one loop inside using one set of variables counting to 10, then another loop outside that uses another set of variable counting to 25.

    Here is the basic loop to 30:

    @echo off
    rem put how many dots you want to loop
    set cycles=..............................
    set cntr=
    :LOOP
    set cntr=%cntr%.
    echo around we go again
    if "%cycles%"=="%cntr%" goto done
    goto loop
    :DONE
    echo around we went
    

提交回复
热议问题