Home | Recovery | Cisco How To Net How To | Blog | Search | Forums | Services | Setup Guide | Chicagotech MVP | IT Exam Practice  |  About Us | Contact Us|

Chicago Area Laptop for rent: $35 per day plus $10 for additional day
rental

 

The combination of the two or more IF ERRORLEVEL or nested IF Errorlevel statements

The nested IF statements allow specific selection of an error level because the NOT operator effectively reverses the inequality. For example,

The command IF ERRORLEVEL 5 ...
is equivalent to the algebraic construct
IF E = 5 OR E > 5 THEN ...

while the command
IF NOT ERRORLEVEL 6
is equivalent to the algebraic construct:
IF E < 6 THEN ...

The combination of the two IF commands works as described because the second IF is executed only if the first is true, and the <command> is executed only if the second is true; therefore, the combination of the two commands is executed only if BOTH are true. Because the desired error level is bracketed with the two tests, the entire conditional is TRUE only when ERRORLEVEL is exactly that value.

This same syntax can be expanded to cover a sequential range of ERRORLEVEL return codes by increasing the difference between the values checked for.
 

Related Topics

DOS Errorlevel command
The combination of the two or more IF ERRORLEVEL or nested IF Errorlevel statements
Testing a specific error level using If errorlevel command

 

Bob Lin Photography services

Real Estate Photography services 

 

  This web is provided "AS IS" with no warranties.
Copyright © 2002-2018 ChicagoTech.net, All rights reserved. Unauthorized reproduction forbidden.