ProcessStartInfo

G

Guest

Hi,

Can you let me know why this won't display the standard output on console?

Thanks



Process myProcess = new Process();

ProcessStartInfo myProcessStartInfo = new ProcessStartInfo("ipconfig" );

myProcessStartInfo.Arguments="/all";

myProcessStartInfo.UseShellExecute = false;

myProcessStartInfo.RedirectStandardOutput = true;

myProcess.StartInfo = myProcessStartInfo;

myProcess.Start();

StreamReader myStreamReader = myProcess.StandardOutput;

// Read the standard output of the spawned process.

string myString = myStreamReader.ReadLine();

Console.WriteLine(myString);

myProcess.Close();
 
G

gani

hi,
you just need to replace :
string myString = myStreamReader.ReadLine();
to
string myString = myStreamReader.ReadToEnd();

hope this helps.
 

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

Similar Threads


Top