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

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)
 
G

Guest

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
 
W

w. monthard

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!
 
S

Sunny

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top