Consider below script which I`m using for running the jars:
Rem Start all apps at interval of 10 seconds
start "mlcpro" cmd /k java -Dspring_profile=test -jar "C:UsersserverAppDataRoamingMicrosoftWindowsStart MenuProgramsStartupmlcpro-1.0-RELEASE.jar"
ping -n 10 127.0.0.1 >nul
start "flightprice" cmd /k java -jar "C:UsersserverAppDataRoamingMicrosoftWindowsStart MenuProgramsStartupflightprice-0.0.1-SNAPSHOT.jar"
ping -n 10 127.0.0.1 >nul
start "batwatracker_test" cmd /k java -Dspring_profile=test -jar "C:UsersserverAppDataRoamingMicrosoftWindowsStart MenuProgramsStartupbatwatracker-1.0-SNAPSHOT.jar"
ping -n 10 127.0.0.1 >nul
start "jiraautomation" cmd /k java -jar "C:UsersserverAppDataRoamingMicrosoftWindowsStart MenuProgramsStartupjiraautomation-0.0.1-SNAPSHOT.jar"
ping -n 10 127.0.0.1 >nul
start "batwatracker_prod" cmd /k java -Dspring_profile=prod -jar "C:UsersserverAppDataRoamingMicrosoftWindowsStart MenuProgramsStartupbatwatracker-1.0-RELEASE.jar"
ping -n 10 127.0.0.1 >nul
start "cts" cmd /k java -Dspring_profile=prod -jar "C:UsersserverAppDataRoamingMicrosoftWindowsStart MenuProgramsStartupcts-1.0-RELEASE.jar"
ping -n 10 127.0.0.1 >nul
start "cls" cmd /k java -Dspring_profile=prod -jar "C:UsersserverAppDataRoamingMicrosoftWindowsStart MenuProgramsStartupcls-1.0-RELEASE.jar"
ping -n 10 127.0.0.1 >nul
Here ping line is for 10 sec delay, timeout was not working.
I want to add few lines at the beginning of this script which will terminate and close all the cmd windows opened by above commands.
In simpler words, I want to use this script to completely shutdown these apps and restart.
- I tried pulling PIDs, and doing taskkill, but not successful in getting PIDs
- Tried terminating all java instances by taskkill with /f flag which terminates other java background services
New contributor
vinayak bhatt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.