Reference: http://hi.baidu.com/lpf2008007/blog/item/a3fa9a3928bcd9f13a87ce8d.html
1. If errorlevel tests the return status of the previous program, if the return status of the program is large or equal to the value described, execute the doscommand
Today, a remote customer, found that his server will be automatically disconnected from the network, causing the client can not connect the service side, but restart the service and return to normal after the initial judgment may be due to a system
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%
IF-ERRORLEVEL
Create TEST4.BAT with the following content:@ ECHO OFFXcopy c: \ AUTOEXEC. bat d :\If errorlevel 1 ECHO file copy failedIf errorlevel 0 ECHO, the file is successfully copied.Then execute the file:C: \> TEST4If the file is successfully
Their function is to judge the return value of the last command.By default, the return value of one command is only 2, 0 indicates success, and 1 indicates failure.But there are exceptions, some command return values will be greater than 2, the
Frequently-used commands echo, @, call, pause, and REM (TIPS: Use: instead of REM) are the most frequently-used commands for batch file processing. We started from them.
First, @ is not a command, but a special identifier for DOS batch processing.
First, the batch file is a text file, and each line of the file is a DOS command (most of the time, like the command line we execute at the DOS prompt), you can use the DOS edit or Windows Notepad (Notepad) Any text file Editing tool creates and
First, the batch file is a text file, and each line of this file is a DOS command (most of the time it is like the command line we execute at the DOS prompt ), you can use any text file editing tool such as edit in DOS or notepad in Windows to
Frequently-used commands echo, @, call, pause, and REM (TIPS: Use: instead of REM) are the most frequently-used commands for batch file processing. We started from them.
First, @ is not a command, but a special identifier for DOS batch processing.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.