Say I have this batch file:
::Stuff
set counter=1
set amount=10
:BEGIN
::More stuff
set /a "counter+=1"
if %counter% LEQ %amount% goto BEGIN
::END
It is not continuing even when counter
reach amount
. What am I doing wrong?
The reason I am not using a for loop is I need a variable to store the counter, and this would seem to be the easier route, not to mention FOR
in batch is very weird compared to C-style methods of for()
.
Solved. If command corrected as follows:
if /i %counter% LEQ %amount% goto BEGIN