Thanks Someone,
But how can I trap pro.StandardOutput.ReadToEnd() into a string so that i
can find a text in it?
Thanks
"Someone" wrote:
> 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" <(E-Mail Removed)> wrote in message
> news:8A640634-3BD2-4EA1-A60D-(E-Mail Removed)...
> >I already use processInfo but how do i trap the text that is written on the
> > console?
> >
> > Thanks
> >
> > "(E-Mail Removed)" 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
> >>
>
>
>
>
|