You are currently offline, waiting for your internet to reconnect

Exit Codes or Errorlevels Set by MS-DOS Commands

This article was previously published under Q81819
This article has been archived. It 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)
  • FIND
  • GRAFTABL (codes defined in versions 3.3x and later)
  • KEYB (codes defined in versions 4.x and later)
  • MOVE
  • 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.
3.2 3.20 3.21 3.3 3.30 3.3a 3.30a 4.0 4.00 4.0a 4.00a 4.01 4.01a 5.00 5.00a 6.00 6.20

Article ID: 81819 - Last Review: 12/04/2015 09:12:44 - Revision: 2.1

Microsoft MS-DOS 3.1, Microsoft MS-DOS 3.2 Standard Edition, Microsoft MS-DOS 3.21 Standard Edition, Microsoft MS-DOS 3.3 Standard Edition, Microsoft MS-DOS 3.3a, Microsoft MS-DOS 4.0 Standard Edition, Microsoft MS-DOS 4.01 Standard Edition, Microsoft MS-DOS 5.0 Standard Edition, Microsoft MS-DOS 5.0a, Microsoft MS-DOS 6.0 Standard Edition, Microsoft MS-DOS 6.22 Standard Edition

  • kbnosurvey kbarchive KB81819