In general, a Windows user cannot launch a batch file and suppress the Terminate batch job (Y/N) prompt on Ctrl+C without some serious workarounds or limitations.

But, I am wondering with a Cygwin shell (bash) in particular, can I launch it in such a way as to handle Ctrl+C without encountering the Terminate batch job (Y/N) prompt on the exit of the shell.

Perhaps, if launching it via a batch file necessarily causes that prompt on Ctrl+C, then does an effective way to launch it exist outside of a batch file? I know that the Cygwin.bat file does configure some variables, so I would prefer to be able to configure similar variables with another workaround.

I would like a general answer, but I am using the ConsoleZ wrapper to contain the terminal session(s), so I would give more weight to answers that work within this framework.


Note that the Cygwin.bat file invokes the shell (bash --login -i in my instance), so why not invoke the shell directly? So, however you launched the batch file, launch the bash executable instead.

In ConsoleZ, this means that for your Tab (in the Tabs section), set the Shell parameter to the location of your bash.exe file, instead of your Cygwin.bat file. But, don't forget to set your parameters (e.g. --login -i) in that Shell field as well. Thankfully, ConsoleZ has an Environment tab in your Tabs section, where you can also set additional environment variables, as necessary.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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