Name
exit
Synopsis
End the current Command Prompt session and close the window.
Syntax
exit [/b] [exitcode]
Description
Typing exit has the same effect as closing the
Command Prompt window with the [x] button.
exit accepts the following options:
-
/b If
exitis used from within a batch file, it will close the current Command Prompt window. Specify/bto exit the batch file but leavecmd.exerunning.-
exitcode Specifies a numerical “exit code” number that is passed to the application or process that launched the Command Prompt or started the batch file.
Exitcodeis typically used when one batch file runs another batch file and wishes to report to the “parent” batch file whether successful or not.
Notes
If you start a new Command Prompt session by typing
cmd in an open Command Prompt window,
exit will end that session. However, since the
“parent” session is still active,
the window won’t close until you type
exit again.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access