9

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?

user1797443
  • 216
  • 1
  • 5
  • 14

1 Answers1

16
@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.

StarPinkER
  • 13,803
  • 6
  • 53
  • 80