[C#] Calling several processes in a same dos window

  • Thread starter Thread starter w.monthard
  • Start date Start date
W

w.monthard

Hi,
here is my trouble:

I need to call 2 différents processes in a same dos window,
the first one is needed for the 2nd, and I have to pass several different
arguments to the 2nd.
My problem is that there are as many dos windows as calls to
"myProcess.start()", and I don't know how to do ...
Anybody has an idea ?

Thanks in advance (and sorry for my bad English)
 
One solution would be to create a batch file that wraps the logic you need to do. Your C# code could then just execute the batch file. There may be a more elegant solution, but this should work.

Dan
 
If I don't find the solution to execute these 2 processes in the same
dos window, I think I will do like that.
Thanks.

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Hi,

something like this? :

startInfo = new ProcessStartInfo("mysecondapp.exe);
startInfo.Arguments = "param1 param2 param3";
startInfo.CreateNoWindow = true;
startInfo.UseShellExecute = false;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardError = true;

getpub = new Process();
getpub.StartInfo = startInfo;
getpub.Start();
getpub.WaitForExit();

Console.WriteLine(getpub.StandardOutput.ReadToEnd());


Or, you can start a second thread, which just reads the standard output
from the process and display it while the process is running.

Sunny
 
Back
Top