Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Batch Script Run Multiple Jar Files At once

I have two batch files which I would like to run at once. So I wrote this:

@echo off
java -jar happyjar.jar
java -jar sadjar.jar
pause

When I run the script, it first runs happyjar, then runs sadjar. Is it possible to run both jars at once without running multiple batch files?

like image 288
user1797443 Avatar asked Jan 28 '13 02:01

user1797443


1 Answers

@echo off
start "Title1" java -jar happyjar.jar
start "Title2" java -jar sadjar.jar
pause

The start command runs your command in a new window, so all 3 commands would run asynchronously.

Don't add /wait option, otherwise it will wait for this new window to complete before going to the next command.

like image 67
StarPinkER Avatar answered Sep 22 '22 20:09

StarPinkER