ChanChow
ChanChow

Reputation: 1366

How to write a batch file to run applications opening in different command prompts?

I would like to run three servers on my Windows machine from command prompt. For this I would like to write a batch file to run these opening three different command prompts.

Upvotes: 0

Views: 1366

Answers (3)

RLH
RLH

Reputation: 1593

To generate 3 new CMD windows that remain open, use the following command syntax:

start "application1" cmd.exe /k dir *.exe
start "application2" cmd.exe /k dir *.xml
start "application3" cmd.exe /k dir *.bat

Where the command after /k is whatever application command line that you want to launch.

Replace the "application#" with some TITLE for the window, that makes sense for you (otherwise it will just say something like C:\Windows\System32\CMD.exe).

The windows will stay open, but that doesn't mean your application will still be running. Like the Dir examples above, it may end but the window will remain.

The full command syntax for START is found here.
The full command syntax for CMD is found here.

Upvotes: 1

Bali C
Bali C

Reputation: 31221

This should do what you want

start application1
start application2
start application3

This will start 3 applications which will open with 3 different command prompts, whether or not they will keep running or not will depend on the app.

Upvotes: 0

Ferdinando Randisi
Ferdinando Randisi

Reputation: 4378

Why batch?

If you can, my best suggestion would be to ditch batch and download cygwin in order to use bash instead.

You will find bash much more flexible, used (which means you are far more likely to get support from others), and supported.

I am a windows user and tried to learn batch some time ago, but it was really really frustrating. bash is so much more user friendly.

Upvotes: 0

Related Questions