I am using a batch file to launch two different applications at the same time in different command line windows. Here is what I have:

start cmd /k
cd Windows\System32\ 
diskpart.exe >NUL & 
diskperf.exe >NUL &  

Repeat for every app you want to run.

I run this and it opens a new command prompt running both applications one after the other. However the other window opens and is waiting for a command.

Any ideas on putting the 2nd and following commands go into the separate command prompts per & statement.

link|improve this question

38% accept rate
Is powershell an option instead of batch? – jftuga Aug 17 '11 at 14:36
yes. Powershell is an great option. Ideas on how to do this in powershell? – mikedopp Aug 17 '11 at 14:41
feedback

4 Answers

up vote 2 down vote accepted

Try this:

cd Windows\System32\ 
cmd /k diskpart.exe
cmd /k diskperf.exe
link|improve this answer
nope still runs just one cmd prompt window and never launches the second cmd. – mikedopp Aug 17 '11 at 14:52
feedback

Tweeked what @TiZon put.

start cmd /k diskpart.exe
start cmd /k diskperf.exe
link|improve this answer
Yeah tried that with: start cmd /k cd windows\system32\ diskpart.exe & start cmd /k cd windows\system32\ diskperf.exe still get two cmd prompts but says system cannot find the path specified. – mikedopp Aug 17 '11 at 15:02
actually that works. Can I do this with CLI apps in program folders? I have set the environmental variable of the Program folder however it crashes when I do this. – mikedopp Aug 17 '11 at 15:09
You can just use the full path to call the app. IE start cmd /k c:\program files\some program\app.exe – Nixphoe Aug 17 '11 at 15:15
Put the full path in quotes :) – Nixphoe Aug 17 '11 at 15:24
1  
Where did you put the quotes Mike? it should look like: start cmd /k "c:\program files\some program\app.exe" – RobW Aug 17 '11 at 16:42
show 5 more comments
feedback

I'm using Windows XP, so YYMV with more recent versions.

The redirection is hiding execution problems with Diskpart.exe and if it got that far, for diskperf.exe as well. Diskpart is waiting for input, and diskperf requires a command line arguement.

If I understand you correctly, you want near parallel execution of diskpart.exe and diskperf.exe.

This might accomplish what you want - create a batch file with these lines:

start cmd.exe /k "diskpart.exe &exit"
start cmd.exe /k "diskperf.exe /? & pause &exit"
start cmd.exe /k "c:\progra~1\intern~1\iexplore.exe &exit"

I've removed the redirection, and made the output of each command visible. The trailing &exit closes the window when the command is finished. Remove the &pause lines and the programs will exit normally.

I could only get IE to launch if I reduced the path to its 8.3 format.

link|improve this answer
feedback

use

cd Windows\System32\

call diskpart.exe

call diskperf.exe

try

call start cmd /k diskpart.exe call start cmd /k diskperf.exe

link|improve this answer
That works but keeps the commands in one command line window – mikedopp Aug 17 '11 at 15:52
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.