Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the differences between errorlevel and% errorlevel% in bat

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report