Run a silent batch command on Windows
I have a .bat
file to run some programs (Apache httpd, Tomcat, ecc.). These programs have their own window and if I just type this into the .bat
file:
../apache/bin/httpd.exe
../tomcat/bin/catalina.exe
...
When this runs I get many prompt windows, how can I prevent this?
Solution 1:
Add at the beginning of the batch file:
@echo off
The commands in the Batch file would actually be start
start /B ../apache/bin/httpd.exe
start /B ../tomcat/bin/catalina.exe
http://ss64.com/nt/start.html
/B : Start application without creating a new window. In this case ^C will be ignored - leaving ^Break as the only way to interrupt the application
Solution 2:
Another way to solve this problem is to use CHP http://www.commandline.co.uk/chp/
This program run an hidden process and return its PID by return code. Than you can use this pid to close the process with taskkill.