# Solved: batch file opening up multiple cmd windows



## elim312

I'm trying to create a batch file that will allow me to open two separate cmd windows, and title each one a different name, and try change directories to a specific location. I also have it opening 3 other programs (calc, firefox, and pidgin) this is what my batch file looks like:

@echo off
start %SystemRoot%\system32\calc.exe
start "" "C:\Program Files\Pidgin\pidgin.exe"
start "" "C:\Program Files\Mozilla Firefox\firefox.exe"
TITLE admin tool
cmd /k cd "C:\Development\VirtualTradingSystem\clean_trunk\tf-tradeweb"
TITLE temp_pass.py
cmd /k cd "C:\Development\VirtualTradingSystem\clean_trunk\scripts"

This first command window opens, it titles itself admin tool, and goes to the below directory. But I can't get the second one to open all the programs open as well.


----------



## Squashman

In order to open up a 2nd and 3rd cmd window you would need to use the start command to open them.

start cmd /k cd "C:\Development\VirtualTradingSystem\clean_trunk\tf-tradeweb"

But the problem you are going to run into is that the next command will still execute in the first cmd window. So it will change the Title bar of the first cmd window and not the one you just opened.

I think the only way you would be able to do what you want is to have the first batch file launch two other batch files that execute the commands you want.


----------



## elim312

Yes, but unfortunately I need it in one file, that sucks. Thank you anyways.


----------



## Squashman

elim312 said:


> Yes, but unfortunately I need it in one file, that sucks. Thank you anyways.


That is a problem we can fix. You just build the 2nd and 3rd batch files within the first batch file using echo statements to a temporary batch file, then execute those temp batch files and delete them when they are done.


----------



## TheOutcaste

Are you actually wanting to run some commands in each window, or just open them to the given path and with the given title?
If the latter, this should do it


Code:


@echo off
start %SystemRoot%\system32\calc.exe
start "" "C:\Program Files\Pidgin\pidgin.exe"
start "" "C:\Program Files\Mozilla Firefox\firefox.exe"
Start "admin tool" cmd /k cd "C:\Development\VirtualTradingSystem\clean_trunk\tf-tradeweb"
Start "temp_pass.py" cmd /k cd "C:\Development\VirtualTradingSystem\clean_trunk\scripts"

you can also specify the starting directory in the Start command:


Code:


@echo off
start %SystemRoot%\system32\calc.exe
start "" "C:\Program Files\Pidgin\pidgin.exe"
start "" "C:\Program Files\Mozilla Firefox\firefox.exe"
Start "admin tool" /D "C:\Development\VirtualTradingSystem\clean_trunk\tf-tradeweb" cmd /k
Start "temp_pass.py" /D "C:\Development\VirtualTradingSystem\clean_trunk\scripts" cmd /k


----------



## Squashman

Duh. Can't believe I forgot about the title option with the start command.
_Posted via Mobile Device_


----------



## elim312

Cool it works thanks alot!!


----------

