jangles
jangles

Reputation: 323

CMD thinks 8 is greater than 65

I have a batch file similar to my previous question but messing with the script a bit more I realize that the load variable in that script is a string, not an integer, so when an if statement such as

set load=8 if "%load%" geq "65" (echo larger) else (echo lesser) is ran, the output would be larger.

This did not fix the issue.

I have tried doing set /a load and if "%load%" gtr "65" but neither fix the issue.

Upvotes: 3

Views: 138

Answers (1)

clabe45
clabe45

Reputation: 2454

By using "" quotes, you're comparing strings (which really doesn't make sense with GEQ). Change your code to:

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

Upvotes: 6

Related Questions