this is a solution

September 15, 2011 at 04:36:12
Specs: Windows Vista
closing command window after batch file runs an .exe - tried various permutations of EXIT and /C - the only variant that ran the .exe and immediately closed the cmd window was having /C at the end. e.g.
"C:\Program Files (x86)\Java\jre6\bin\javaw.exe" -Xmx1024m -Xms1024m -jar "C:\Users\blah\blah\blah.exe"

simple i know, but i was looking for this answer, perhaps there are other noobs out there trying to do the same :)

See More: this is a solution

Report •

September 15, 2011 at 04:55:54
cmd.exe /?

First option: /C


Happy is ONE who says I am an OttoMAN.

Report •

September 15, 2011 at 05:41:42
yarp, as indicated, i r noob indeed at this stuff. initial google inquiry mentioned EXIT, hence trying that.

the main issue was where to place the /C - i repeat, i am noob at this. placing at end of the same line as the desired command didn't work, seems it has to be placed on it's own at the end of the batch to close the cmd window after running the .exe. this wasdiscovered through trial and error. posted findings here to help other noobs.

advising on the cmd.exe /? is a helpful comment, many thanks :)

Report •

September 15, 2011 at 06:57:13
The /C at the end does nothing, other than look for an executable file called "C" on the root of the current drive.

The default is to close the console window once the script ends. No additional steps should be necessary.

How To Ask Questions The Smart Way

Report •

Related Solutions

September 15, 2011 at 07:32:15

when i placed the /C at the end of the .exe line (with a space between the end quotes and the forward slash : i.e. ...\blah.exe /C) once the .exe launched it filled the first field (username) of the app with '/C' and didn't close the cmd window. with /C on its own line at the end of the batch it did close the window and left the username field blank. as i said, trial and error of the noob! ;)

incidentally, checking cmd.exe /? as advised enlightened me to the /Q instead of typing the massive echo off, so that was nice.

Report •

Ask Question