using System;
using System.Diagnostics;
class Class1
{
static void Main(string[] args)
{
ProcessStartInfo procInfo = new ProcessStartInfo("ping", "127.0.0.1");
procInfo.CreateNoWindow= false;
procInfo.UseShellExecute = false;
procInfo.WindowStyle = ProcessWindowStyle.Hidden;
procInfo.RedirectStandardOutput = true;
Process pro = new Process();
pro.StartInfo = procInfo;
pro.Start();
Console.WriteLine(pro.StandardOutput.ReadToEnd());
Console.ReadLine(); // just to wait...
}
}
"me" <me@discussions.microsoft.com> wrote in message
news:8A**********************************@microsof t.com...
I already use processInfo but how do i trap the text that is written on the
console?
Thanks
"ja*****@texeme.com" wrote:
You can use the ProcessInfo class and trap standard output from any DOS
command.
me wrote: > How do i trap the incomming data to the console?
> lets say I wrote a console app that pings another computer in the
> network.
> I see the following in the console:
>
> Reply from 180.100.24.5: bytes=32 time<10ms TTL=127
> Reply from 180.100.24.5: bytes=32 time<10ms TTL=127
> Reply from 180.100.24.5: bytes=32 time<10ms TTL=127
>
> I want to trap all this into a string. How can I do this?
>
> Thanks in advance