I'm looking for a mechanism for suppressing the "Terminate batch job? (Y/N)" invitation that I get whenever I press CTRL-C in a program started from a batch file:
batch file: jsshell.bat:
@echo off java -jar build-scripts\contrib\rhino1.7R1.jar
and then starting it on cmd shell by:
> jsshell.bat
which gives me a shell that can be exited by CTRL-C but after invoking CTRL-C I get a "Terminate batch job (Y/N)?" message which is nasty and annoying. How can I get it to just exit without me having to press 'y'?
Add a pause statement to a batch file If you're creating a batch file and want the MS-DOS window to remain open, add PAUSE to the end of your batch file. This prompts the user to Press any key. Until the user presses any key, the window remains open instead of closing automatically.
Execution of a batch script can also be paused by pressing CTRL-S (or the Pause|Break key) on the keyboard, this also works for pausing a single command such as a long DIR /s listing. Pressing any key will resume the operation.
Windows. Once a command is launched from the GenRocket batch command, the user may terminate the command by pressing Ctrl+C or Ctrl+Break. Once the termination is initiated, the DOS command interpreter presents the user with the option to terminate the batch with either a Y or N option.
At this site, I finally found an effective solution:
script.cmd < nul
To not have to type this out every time I made a second script called script2.cmd
in the same folder with the line above. You may want to reverse the names. Works for me, but tested so far on XP only.
The behaviour is implemented in the cmd.exe source code, and isn't possible to turn off without modifying cmd.exe. However you can modify cmd.exe to not show the message.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With