Return Values Using Exitcode

Previous  Next

The return values within a batch file can be handled as follows:

 

COUNT.BAT:

PSDOS.EXE /partition

If Errorlevel 3 Goto LABEL3      ; The sequence must always

If Errorlevel 2 Goto LABEL2      ; view the highest Errorlevel

If Errorlevel 1 Goto LABEL1      ; first!

 

Echo INSTALL.BAT: No partitions exist!

 

:LABEL1

Echo INSTALL.BAT: One partition exists!

Goto END

 

:LABEL2

Echo INSTALL.BAT: Two partitions exists!

Goto END

 

:LABEL3

Echo INSTALL.BAT: Three or more partitions exist!

Goto END

 

:END

 

Additional information about batch programming is listed in the manual of the DOS operating system.

 

 

See also:

Command Line Options

Script File