Closing Command Prompt

Maintained on

When working with Command Prompt, it is important to first learn how to exit it.

This page introduces four methods to close Command Prompt.

Close with × Button

This method is common to other windows in Windows, but you can close Command Prompt by clicking the × button in the upper right corner of the Command Prompt window.

This is the button in the upper right corner of the sample below.

×
Command Prompt Icon
Command Prompt
Microsoft Windows [Version xx.x.xxxxx.xxx]
(c) 2025 Ribbit App Development All rights reserved.
 
C:\users\user>

You might worry that some process might remain, but even if you close Command Prompt this way, any processes launched from that Command Prompt will also terminate simultaneously.

However, for processes that could cause problems if terminated midway (such as file writing), it is recommended to wait until the process completes normally or terminate it using an appropriate method.

Close from Right-Click Menu

This method is also common to other windows in Windows. Right-clicking the title bar of the Command Prompt window displays a context menu.

Clicking “Close” in that menu will close Command Prompt.

Also, right-clicking the icon in the upper left corner of the window displays the same menu. This menu can also be displayed with Alt + Space.

×
Command Prompt Icon
Command Prompt
Microsoft Windows [Version xx.x.xxxxx.xxx]
(c) 2025 Ribbit App Development All rights reserved.
 
C:\users\user>

Close with exit Command

Command Prompt has an exit command prepared to terminate the currently running process.

You can close Command Prompt by executing this command.

×
Command Prompt Icon
Command Prompt
Microsoft Windows [Version xx.x.xxxxx.xxx]
(c) 2025 Ribbit App Development All rights reserved.
 
C:\users\user>exit

When you execute the above command, the process you are currently using terminates, and Command Prompt closes.

For details on the exit command, please refer to the following page.

Close with Alt + F4

With the Command Prompt window active, pressing Alt + F4 will close Command Prompt.

Similar to the first method, processes launched from Command Prompt will also terminate simultaneously, so if there are running processes, it is recommended to terminate them using an appropriate method.

×
Command Prompt Icon
Command Prompt
Microsoft Windows [Version xx.x.xxxxx.xxx]
(c) 2025 Ribbit App Development All rights reserved.
 
C:\users\user>

Summary

There are four methods to close Command Prompt as described above.

Whichever method you use, processes launched from Command Prompt will also terminate simultaneously, so if there are running processes, it is recommended to terminate them using an appropriate method.

Also, methods other than the exit command are common to other windows in Windows, so it’s useful to remember them.

#Command Prompt #Batch File #Arguments #Command Line #Command