Thursday, December 21, 2006

Cygwin users: Get rid of the "Terminate batch job annoyance"!

Just figured this out and thought I would pass it along. If you find it useful, please send me your Christmas bonuses.

I am constantly using cygwin (and IMHO every Windows-oriented developer should be doing the same), but I find it rather annoying when I go to close it using Ctrl+D, Windows XP always asks me:

Terminate batch job (Y/N)?

Why? Because the mouth-breathing people who wrote Windows like annoying you. As a result, they decided that anytime someone ran a batch file, when the batch file was terminated early they would ask if you really meant to do that. Yes, you are stupid. You didn't really mean to hit Ctrl+C, but rather meant to send a letter to your Aunt Tilly using the Microsoft Vexation Paperclip (MVP), which can help you write that missive. It can do this for many other things too. Incessantly.

This results in my having to press Ctrl+C, clicking on the X in the window, or some other such irritant. I calculate that, with the extra time it takes to tell Windows to take a hike, I have spent approximately 2.6458 work hours during my time at my current employment. This is time that could have been spent doing more productive things, such as writing Unit Tests, emptying my Recycle bin (Oh, no, you really didn't want Windows to remove that, did you? Even though the system already asked you if you really Really REALLY wanted to remove it already? Oh, no, you are stoooooopid!), or send witty emails to my co-workers. So....

The solution is to start cygwin without using the cygwin.bat file. Here is what you do:

* Right-click on the cygwin icon/shortcut and select Properties in the popup menu. A dialog box should pop up. (If it doesn't, you are screwed. Go to Jail. Do not pass Go, do not collect $200.)

* In the Target entry field, put the following (instead of the call to cygwin.bat):

C:\cygwin\bin\bash.exe --login -i

(change the path to wherever you installed cygwin if you did it the non-standard way, you rebel scum).

* Click on OK to close the dialog.

* You will now note that when you click on your shortcut, your cygwin window will open as you are used to, but now Ctrl+D will immediately close the window!

Your welcome.


At 2:59 AM, Anonymous Anonymous said...


: To suppress the confirmation "Terminate batch job (Y/N)?" after Ctrl+C
:bash --login -i
start "Cygwin" /b bash --login -i


Post a Comment

<< Home