Testing for a Specific Error Level in Batch Files (69576)
The information in this article applies to:
• Microsoft MS-DOS operating system 3.1
• Microsoft MS-DOS operating system 3.2
• Microsoft MS-DOS operating system 3.21
• Microsoft MS-DOS operating system 3.3
• Microsoft MS-DOS operating system 3.3a
• Microsoft MS-DOS operating system 4.0
• Microsoft MS-DOS operating system 4.01
• Microsoft MS-DOS operating system 5.0
• Microsoft MS-DOS operating system 5.0a
• Microsoft MS-DOS operating system 6.0
• Microsoft MS-DOS operating system 6.2
• Microsoft MS-DOS operating system 6.21
• Microsoft MS-DOS operating system 6.22
This article was previously published under Q69576
SUMMARY
The Microsoft MS-DOS "IF ERRORLEVEL <number>" statement checks for
error levels of the given number or greater. If you want to check for
a specific error level, you should use the following command construct
IF ERRORLEVEL <N> IF NOT ERRORLEVEL <N+1> <COMMAND>
where <N> is the desired number. The <N+1> portion of the command must
be calculated as the command is entered, because the MS-DOS command
interpreter cannot perform mathematical calculations.
Modification Type: |
Major |
Last Reviewed: |
5/10/2003 |
Keywords: |
KB69576 |
|