This article was previously published under Q81819
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
Several MS-DOS commands set a value detectable using the IF ERRORLEVELcommand. These values are called "errorlevels," "return codes," or"exit codes." These commands are:
DEFRAG (codes defined in versions 6.x)
GRAFTABL (codes defined in versions 3.3x and later)
KEYB (codes defined in versions 4.x and later)
MSAV (codes defined in versions 6.0 and later)
SCANDISK (codes defined in versions 6.2 and later)
SETVER (codes defined in versions 5.x and later)
Any program in the MS-DOS environment can set an exit value that canbe detected with IF ERRORLEVEL. Any MS-DOS command can return a value,but only the above commands have exit codes defined in the MS-DOSspecifications. Return values from other commands should not be reliedupon, as they may be different for different versions and dialects ofMS-DOS.
None of the internal MS-DOS commands have defined return codes. Anexternal command is a separate MS-DOS program; internal commands arecontained within COMMAND.COM and are always available for use when theMS-DOS prompt is active.
You can determine if a command is internal or external by checkingyour MS-DOS documentation. In MS-DOS 5.0 and 5.0a, commands are markedas internal or external in the chart that accompanies each command inChapter 14 of the "Microsoft MS-DOS User's Guide and Reference"manual. Earlier versions of the manual include a boxed E or I symbolon the upper outside corner of the page to denote external orinternal.
Customers have suggested that exit codes be defined for allappropriate MS-DOS commands (both internal and external). This featureis under review and will be considered for inclusion in a futurerelease.