Why is this cmd.exe batch if-statement erroring?
I'm running Windows 11 and when I run the following batch file, after I press the enter key, it displays in the command line console:
100 was unexpected at this time.
\>if /A 100 LSS 10 echo "100 is less than 10" else echo "100 is not less than 10"
Here is the file:
set /A c=99
set /A c+=1
pause
if /A %c% LSS 10 echo "%c% is less than 10" else echo "%c% is not less than 10"
pause
100 is the expanded value of %c%, and if I change %c% to !c! in the if statement, the messages still displays, but with !c! instead of 100. Enclosing %c% and !c! with double quotes doesn't help, nor does enclosing the 10.
What is wrong with the if statement?
Thank you