I'm trying to simulate a while loop in Batch, here's my code:
@echo off
set test=0
:main
call:whileLSS %test% 4 :count
:whileLSS
if %1 LSS %2 (
echo %1
call%3
goto whileLSS
)
goto:EOF
:count
set /a test=%test%+1
goto:EOF
This just outputs 0s, instead of outputting "0 1 2 3" like I want it to.
The problem is that the loop goes forever because %1 doesn't have the most updated value of test.
Is this the right approach?
How do I update the value of %1?
Is there a way to not have to hardcode operators like LSS?