They are all judged by the return value of the last command.
When using an if ERRORLEVEL value cmmand a sentence, it means that if the error code value returned is greater than or equal to the value, the Cmmand
Operation
When using an if%errorlevel%== value cmmand a sentence, it means that if the error code value returned is equal to the value, the Cmmand action is performed.
In general, the result of the previous command returned only two values, "success" in 0 means "failed" in 1, in effect, the ERRORLEVEL return value can be
Between the 0~255,
For example, Xcopy defaults to a ERRORLEVEL value of 5, representing 5 execution states respectively:
0 Copy file Success
1 copy File not found
2 user terminated xcopy operation via CTRL C
4 initialization error occurred
5 A disk write error has occurred
If%errorlevel% the numerical comparison method is not limited to equals, you can use parameters to control it.
For example: IF%errorlevel% leq 1 goto okay
All the comparison parameters are as follows:
EQU-equals
NEQ-Not equal to
LSS-Less than
Leq-less than or equal to
GTR-Greater than
GEQ-greater than or equal to