What are the differences between errorlevel and% errorlevel% in bat
This article will explain in detail what is the difference between errorlevel and% errorlevel% in bat. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
They all judge the return value of the last command.
When using the if errorlevel value cmmand sentence, it means that if the returned error code value is greater than or equal to the value, cmmand will be executed
Operation
When using the if% errorlevel%== value cmmand sentence, it means that if the returned error code value is equal to the value, the cmmand operation will be performed.
Generally speaking, the result of the execution of a command returns only two values. "success" means "failure" and "failure" means 1. In fact, the errorlevel return value can
Between 0255and
For example, there are 5 default errorlevel values for xcopy, which represent five execution states:
0 copy the file successfully
1 No copy file found
2 the user terminated the xcopy operation through CTRL C
4 initialization error occurred
5 A disk write error occurred
The method of comparing if% ERRORLEVEL% values is not limited to equals, but can be controlled by parameters.
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
This is the end of the article on "what is the difference between errorlevel and% errorlevel% in bat". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.