Article ID: 39585 - Last Review: May 12, 2003 - Revision: 2.0 Correct Testing Precedence of Batch File ERRORLEVELsThis article was previously published under Q39585 SUMMARY
When you use multiple IF ERRORLEVEL statements in batch files, the order in
which the ERRORLEVELs are tested numerically is important. The correct
order is descending (highest to lowest). This ordering is from the way
ERRORLEVELs are tested. The IF condition is set to TRUE when the ERRORLEVEL
is equal to, or greater than, the ERRORLEVEL number.
MORE INFORMATION
The following batch file fragment demonstrates this INCORRECT behavior:
The CORRECT way to write such a batch file is as follows: APPLIES TO
| Article Translations
|

Back to the top
