[ACCEPTED]-How can I suppress the "terminate batch job" in cmd.exe-cmd

Accepted answer
Score: 27

At this site, I finally found an effective solution:

script.cmd < nul

To 5 not have to type this out every time I made 4 a second script called script2.cmd in the same folder 3 with the line above. You may want to reverse 2 the names. Works for me, but tested so 1 far on XP only.

Score: 18

The behaviour is implemented in the cmd.exe 3 source code, and isn't possible to turn 2 off without modifying cmd.exe. However you 1 can modify cmd.exe to not show the message.

Score: 8

Don't forget to consider working around 1 the problem by avoiding batch scripts.

  • Doskey macros can replace one-liner batch scripts like the one quoted above. (Load them up in your Autorun script.)
  • Cscript.exe is available on every modern Windows machine and can run JavaScript and VBScript programs from the command line
  • If you add file extensions for your favorite scripting language (Perl, Python, Ruby, etc.) to your PATHEXT environment variable and add the script to your path, you can execute them directly without a batch script.
Score: 7

Yes, there is more elegant way than patching 3 cmd.exe. Just put START in front of your 2 command. For your example the line would 1 read like: "START java -jar build-scripts\contrib\rhino1.7R1.jar"

Score: 7

FWIW, piping 'N' as the input for a command 3 worked me for some batch files (but I actually 2 wanted the new window). Maybe it will work 1 for you too.

(echo. N)| cmd /c java -jar build-scripts\contrib\rhino1.7R1.jar
Score: 4
@start cmd /c java -jar build-scripts\contrib\rhino1.7R1.jar
@exit

this will make only one window

0

Score: 3

The modification below suppresses "Terminate 1 batch job? (Y/N)" and the new console window:

start cmd /c java -jar build-scripts\contrib\rhino1.7R1.jar
Score: 2

Try this. It does open a new console, but 1 it locks the other one while it's open.

@echo off
start /WAIT java -jar build-scripts\contrib\rhino1.7R1.jar

More Related questions