[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
ERRORLEVEL()

    ERRORLEVEL() returns the current DOS error level setting and
optionally set the DOS error level to a new value.

Syntax

    ERRORLEVEL([<exp N>])

Argument

    <expN> is the new DOS error level setting.  This can be a value
between zero and 255.

Returns

    An integer numeric value.

    ERRORLEVEL() returns the current DOS error level setting.

Usage

    ERRORLEVEL() is primarily design to use with SWITCH.EXE in order to
chain execution of application programs.  As an example, assume you
have a main application program and depending on some condition, it
needs to execute another .EXE file.  You can do this by setting the
error level just before exiting to DOS as follows:

DO CASE              
IF choice = "ONE"    
   err_lev = 1       
ELSEIF choice = "TWO"
   err_lev = 2       
ENDIF                
ERRORLEVEL(err_lev)  
QUIT                 

You then execute SWITCH from the DOS prompt specifying the list of
executable application programs corresponding to error levels
specified in the shell program.  For example:

    C>SWITCH ONE TWO THREE

This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson