Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there any keyboard shortcut to close the Command Prompt window in Windows 7? Alt+F4 does not seem to work on a Command Prompt window.

I close it right now by typing exit and Enter at the prompt. Hoping there is a shorter trick.

share|improve this question
add comment

5 Answers

up vote 17 down vote accepted
  • Alt+Space, C

  • Create an alias using doskey: doskey x=exit

share|improve this answer
add comment

Wrap CMD in Console2, which would give you CTRL+W to close tabs and ALT+F4 to exit. You will also be able to use CTRL+V to Paste, if you wish, which is one of the main reasons I use it.

share|improve this answer
add comment

Here's an autohotkey script that'll do it.

#IfWinActive ahk_class ConsoleWindowClass
^w::
Send,{LAlt Down}{Space Down}{Space Up}{LAlt Up}{c Down}
return
#IfWinActive

It just sends Alt+Space, C to the window when Ctrl+w is hit (if it's a command prompt).

share|improve this answer
add comment

It depends from your choice of command interpreter. This is, of course, because it is your command interpreter that is (largely) determining how TUI command-line editing works.

If you're using JP Software's TCC/LE, for example, an autoexecuting keystroke alias that does exactly this (and that doesn't suffer from the global hotkey problems mentioned in other answers) is simplicity itself to set up using the ALIAS command:

alias @@f4=*exit

With bash one could do the same thing, using the bind built-in command, to bind the key sequence for the Alt-F4 key to the string exit\n. The tricky part is working out what key sequence Alt-F4 generates (from the point of view of bash, at least) this week.

If you are running your command interpreter within Take Command, closing the current command tab is done with Ctrl+F4.

share|improve this answer
add comment

You could probably use a tool such as AutoHotKey to build a shortcut that would close the window. Or create a shortcut that runs a command using tskill to find all cmd windows and close them. That would cause problems if you ever use more than once CMD window at a time and want to close them only selectively.

share|improve this answer
add comment

protected by Daniel Beck Aug 14 '12 at 10:44

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.