I have an old MS DOS computer running DOS 7.10 (ver command gives: windows 98 ver 4.10.2222). I have to make a batch script that basically runs a command 10 or whatever times. I tried using the for command but it gave me ILLEGAL Command For So now I have:
@ECHO off
SET COUNT=0
:MyLoop
IF "%COUNT%" == "10" GOTO EndLoop
ECHO %COUNT%
SET /a COUNT+=1
:EndLoop
ECHO done
However, this gives me an infinite loop of 0 as if set command is not working. The command DOES work in CMD in windows 10 though. Can anyone suggest what I am doing wrong? Or a way to implement a for loop in DOS 7 batch file.
This Batch file do what you requested. As is, this example count up to 123, but it can count up to 999 (1000 times, as you requested). If you need more digits, just add the corresponding sections...
EDIT 03/27/2018: Code modified as suggested in comment
EDIT 03/29/2018: Second attempt
EDIT: New method added
This simpler approach can manage any number of digits in the counter with no modifications: