In my batch file script I need to read a value stored in a text file into a variable and then do a comparison like (equals, greater, less etc.) but with the following syntax I was not able to as the variable created by Set command was setting the type of this variable as text whereas for comparison of numbers I need to set the type of this variable as numeric.
Original syntax:
set /P mySessionID= < tmp.txt
Putting the variable between % fixed the issue:
set /P %mySessionID%= < tmp.txt
For comparision following are the comparision operators which can be used in a Batch file with If statement:
Operator Meaning
EQU equal to
NEQ not equal to
LSS less than
LEQ less than or equal to
GTR greater than
GEQ greater than or equal to
No comments:
Post a Comment