I tried the following command.
@echo off
set /a var1=2
set /a var2=4
if %var1%<%var2%
echo yesss
But am getting the following error.
2< was unexpected at this time.
Please can someone assist
You need to make a couple of changes:
LSS
operator rather than <
if
statement on one lineSo your script will look like this...
@echo off
set /a var1=2
set /a var2=4
if %var1% LSS %var2% echo yesss
I ended up achieving the result you wanted by using:
@echo off
set /a var1=2
set /a var2=4
if %var1% LSS %var2% echo yes
There is a helpful post relating to the comparative operators here.
Just saw Richard beat me to it. Still the link should be a good reference!