1

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.

Peeyush
  • 253
  • 4
  • 9

4 Answers4

2

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.

grawity
  • 501,077
1

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

uSlackr
  • 9,053
0

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.

TheBW
  • 351
0

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

horatio
  • 3,719