Exit command

Updated: 11/12/2023 by Computer Hope
Exit command entered at a command line.

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

Availability

Exit is an internal command and is available in the following Microsoft operating systems.

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 quits 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

Exit examples

exit
  • When in another command interpreter, exit takes you out of the new command interpreter and back into the original.
  • When entering DOS from Windows, exit would return you to Windows.
  • If you're in the Recovery Console, exit would close the Recovery Console and reboot the computer.