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

Which If commands are commonly used to judge in bat

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly shows you "what are the common judgments of If commands in bat", which are easy to understand and clear, and hope to help you solve your doubts. Let me lead you to study and learn this article "what is the common judgment of If commands in bat?"

If command

If said it would determine whether the specified conditions were met and then decide to execute different orders.

There are three formats:

1), if "parameter" = = "string" command to be executed

If the parameter is equal to the specified string, the condition holds, run the command, otherwise run the next sentence. (note that there are two equal signs)

For example, if "% 1" = "a" format a:

If {% 1} = = {} goto noparms

If {% 2} = = {} goto noparms

2), if exist file name command to be executed

If there is a specified file, the condition is established, run the command, otherwise run the next sentence.

Such as if exist config.sys edit config.sys

3), if errorlevel / if not errorlevel digital commands to be executed

If the return code is equal to the specified number, the condition holds, run the command, otherwise run the next sentence.

Such as if errorlevel 2 goto x2

When the DOS program runs, it will return a number to DOS, which is called error code errorlevel or return code. The common return codes are 0,1.

The above is all the contents of the article "what are the commonly used If commands in bat?" Thank you for your reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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