0

I don't know if I worded this right, but how would I make a batch file differentiate numbers?

For example; In my code, I have a string of code:

IF %var% GTR 0 && LSS 3

When I launch it, it loads the variable and then crashes. I discovered that it was this command causing the prompt to crash.

I want to tell whether if or not a number is greater than 0 and less than 3. For example, 2.

foxidrive
  • 40,353
  • 10
  • 53
  • 68
David Rios
  • 161
  • 1
  • 2
  • 17
  • 2
    That what happens when you make stuff up. `IF %var% GTR 0 If %var% LSS 7 Echo %Var%`. Ponder. Read `if /?`. There is no `&&` in `if`. However `&&` has meaning - see http://stackoverflow.com/questions/31820569/trouble-with-renaming-folders-and-sub-folders-using-batch –  Mar 19 '16 at 22:02

1 Answers1

3

This will still error if %var% is empty, so you can add a test for that also.

IF %var% GTR 0 IF %var% LSS 3 echo %var%
foxidrive
  • 40,353
  • 10
  • 53
  • 68