I can do a while loop in DOS batch file like this:
@REM initialize test value to be "true"
@SET intCounter=1
:while
@REM test condition
@IF %intCounter% GTR 10 (GOTO wend)
@REM procedure where condition is "true"
@echo %intCounter%
@REM set new test value
@SET /a intCounter=intCounter+1
@REM loop
@GOTO while
:wend
@PAUSE
This will loop ten times.
My question are two folds.
-
How can I also control the end of the loop. I tried set end =1 and replace 10 with %end%, this does not work.
-
How to read input from keyboard and set them into iniCounter and end.
Thanks a lot.
I don’t know what you did, but
does work,or
if you want it to be entered by the user
And since your question is tagged ‘windows’, you might be better off with