On Java, Python, Groovy, Grails, Spring, Node.js, Linux, Arduino, ARM, Embedded Devices & Web

Tired of “Terminate batch job (Y/N)?”, try this

Posted by Venkatt Guhesan on June 24, 2011

When you invoke a batch file or most applications in a command-prompt and when you wish to close the application by doing a CTRL+C, you get the annoying “Terminate batch job (Y/N)?” prompt. And in most cases, even if you type a “n”, it still kills the application. Example is the Tomcat startup. To avoid this, try this:

YourScript.cmd < Nul

This should no longer ask you with the annoying prompt “Terminate batch job (Y/N)?”.

Now for a few examples from my everyday usage:

grails run-app < Nul
h2.bat < Nul
startup.bat < Nul
mvn tomcat:run < Nul
mvn jetty:run < Nul



2 Responses to “Tired of “Terminate batch job (Y/N)?”, try this”

  1. User said

    I use a this trick to solve it. 😉


    IF “%~1″==”–FIX_CTRL_C” (
    ) ELSE (
    CALL <NUL %0 –FIX_CTRL_C %*

  2. […] this site, I finally found an effective […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: