Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
DOS/Other
Tag Cloud
access acer asus bios bsod computer crash desktop dns driver drivers error ethernet excel freeze gaming graphics hard drive hardware hdmi internet laptop malware memory monitor motherboard network printer problem ram registry repair router slow software sound trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Operating Systems > DOS/Other >
Solved: batch file opening up multiple cmd windows

Reply  
Thread Tools
elim312's Avatar
Junior Member with 3 posts.
 
Join Date: Jan 2010
Experience: Beginner
29-Jan-2010, 03:47 PM #1
Solved: batch file opening up multiple cmd windows
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's Avatar
Trusted Advisor with 18,706 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
Experience: Bocks of Rox
30-Jan-2010, 12:19 AM #2
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's Avatar
Junior Member with 3 posts.
 
Join Date: Jan 2010
Experience: Beginner
03-Feb-2010, 12:13 PM #3
Yes, but unfortunately I need it in one file, that sucks. Thank you anyways.
Squashman's Avatar
Trusted Advisor with 18,706 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
Experience: Bocks of Rox
03-Feb-2010, 01:08 PM #4
Quote:
Originally Posted by elim312 View Post
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's Avatar
Computer Specs
Distinguished Member with 9,048 posts.
 
Join Date: Aug 2007
Location: Oregon, USA
Experience: Intermediate
03-Feb-2010, 09:42 PM #5
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's Avatar
Trusted Advisor with 18,706 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
Experience: Bocks of Rox
03-Feb-2010, 10:48 PM #6
Duh. Can't believe I forgot about the title option with the start command.
Posted via Mobile Device
elim312's Avatar
Junior Member with 3 posts.
 
Join Date: Jan 2010
Experience: Beginner
05-Feb-2010, 11:40 AM #7
Cool it works thanks alot!!
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 08:09 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.