CMD thinks 8 is more than 65

I have a batch file similar to my previous question , but messing around with the script is a bit more involved. I understand that the load variable in this script is a string and not an integer, so if an if statement like

set load=8 if "%load%" geq "65" (echo larger) else (echo lesser)

starts, the output will be larger

.

This didn't fix the problem.

I tried doing set /a load

and if "%load%" gtr "65"

but didn't fix the problem.

+3


source to share


1 answer


By using quotes ""

you are comparing strings (which really doesn't make sense with GEQ

). Change your code to:



if %load% geq 65 (echo larger) else (echo lesser)

      

+6


source







All Articles