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.
ECHO OFF
"C:\Program Files (x86)\Java\jre6\bin\javaw.exe" -Xmx1024m -Xms1024m -jar "C:\Users\blah\blah\blah.exe"
/Csimple i know, but i was looking for this answer, perhaps there are other noobs out there trying to do the same :)
cmd.exe /? First option: /C
Noob..
Happy is ONE who says I am an OttoMAN.
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 :)
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.
interesting. 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.
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |