Microsoft DOS exit command

Updated: 11/10/2017 by Computer Hope

About exit

The exit command is used to withdrawal from the currently running application and the MS-DOS session.


The exit command is an internal command and is available in the below Microsoft operating systems.

All Versions of MS-DOS
Windows 95
Windows 98
Windows ME
Windows NT
Windows 2000
Windows XP
Windows Vista
Windows 7
Windows 8
Windows 10

Exit syntax

Windows Vista and later syntax

Quits the CMD.EXE program (command interpreter) or the current batch script.

EXIT [/B] [exitCode]

/B Specifies to exit the current batch script instead of CMD.EXE. If executed from outside a batch script, it will quit CMD.EXE.
exitCode Specifies a numeric number. If /B is specified, sets ERRORLEVEL that number. If quitting CMD.EXE, sets the process exit code with that number.

Windows XP and earlier syntax

Quits the COMMAND.COM program (command interpreter).


Exit examples


  • When in another command interpreter, would exit you out of the new command interpreter into the original.
  • When entering DOS from Windows, would return you to Windows.
  • If in the recovery console, would exit the recovery console and reboot the computer.

Additional information

  • See our exit definition for further information and related links on this term.