How to close command prompt using the exit command

Do you know the “proper” way to close the command prompt?

If your answer was “yes, press the x button” then read on to learn how to close the command prompt window like a professional.

Open Command Prompt as Administrator

1) Press the Windows Key
2) Type cmd and press return
3) Right Click the Command Prompt icon and select ‘ Run as Administrator’

Type the command

In the command prompt window enter the below command and press return

exit

And as if by magic, the command prompt window will close

exit command options

The exit command has a few additional options that are primarily intended to be used if executing a batch script or applying an error level

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.

Leave a Comment