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.

link|improve this question

68% accept rate
feedback

5 Answers

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

  • Create an alias using doskey: doskey x=exit

link|improve this answer
feedback

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.

link|improve this answer
feedback

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.

link|improve this answer
feedback

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.

link|improve this answer
feedback

no there isn't. I have been a network engineer for 10 years so I can assure this is the case. I use exit all the time.

link|improve this answer
which cheeky little girl voted this down?? It is the truth. Don't vote me down just because you don't like the answer! – Mucker May 27 '11 at 14:49
1  
That's the point of downvoting, isn't it? (I'm guessing it was because of the "I have been a network engineer for 10 years" bit, when the question is not related to networks at all.) – grawity May 27 '11 at 15:03
That bit was to justify my answer. Try not to be so defensive when you read this comment but what if I'd have just "no there isn't"? Which is actually true. That definitly would have been voted down and he'd have thought I wasn't being unhelpful. so I tried to justify my reasons for saying it. Also it has everything to do with being a network engineer. Do you know how many network tools, commands, troubleshooting stuff etc is called from the command prompt?? nearly all of them. a network engineer probably uses the CMD prompt more than a programmer... – Mucker May 27 '11 at 15:09
Alt+Space+C works fine for me, so how is there not a keyboard shortcut to exit CMD? The OP is looking for a shortcut, that's a shortcut. – Thiago M. May 27 '11 at 16:40
feedback

Your Answer

 
or
required, but never shown

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