Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there any way I can enable Ctrl+D to exit the command prompt, like we do in Unix?

I know that I can set an alias by using doskey, but as we use Ctrl+D or other in Unix, I also want to use this in the Windows command prompt.

I am using Windows 7.

share|improve this question

4 Answers

How about you use 'exit'? It works on Windows and Unix/Linux.

share|improve this answer
it takes four letters to type 'exit', while ctrl+d is considered as shortcuts. That's why we call them shortcuts so that we dont need to type the whole command. – Peeyush Mar 29 '12 at 16:38
No thanks for the sarcasm. – uSlackr Mar 29 '12 at 17:05

Unlike Unix, the line editing capabilities are part of the Windows console windows, not the shell. Because of this, the cmd.exe shell can simply read the input line-by-line and does not perform any special interpretation of your key presses – even CtrlDEnter will be treated as any other command. You can even make a doskey alias for it:

doskey CtrlD=exit

Windows does have an "EOF" control character, CtrlZ, which works similarly to Ctrl-D in Unix; however, it won't work in this case since cmd.exe simply keeps reading even if hits EOF.

share|improve this answer
really ? "doskey Ctrl D=exit" will work ? – Peeyush Apr 2 '12 at 7:31

Since cmd.exe is one of the main and basic applications for windows OS, it is highly unlikely for you to be able to tamper with it, since it is probably

  • Hard coded in application
  • Restricted due to possible security issues (imagine if viruses could tamper with it)

You can always just use alternative tools for these options, or make one of your own. There should be some kind of application that would global change that by pressing ctrl + D you mean ctrl + C, thou it is probably not what you are looking for.

share|improve this answer

there are two shortcuts which will work out of the box: alt+f4 or alt+space, C both work with ALL windows.

share|improve this answer
do you really call "alt+space, C" as shortcut ?, and also AFAIK alt+f4 doesnt work for command prompt – Peeyush Apr 2 '12 at 7:30
alt+space c does, and do you really balk at the need to hit the c key? – horatio Apr 3 '12 at 13:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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