View Single Post
Old 06-28-2005, 10:33 AM   #2 (permalink)
Iron_Cross
 
Ultra Techie

Join Date: Sep 2003

Location: Bamberg, Germany

Posts: 549

Iron_Cross

Send a message via ICQ to Iron_Cross Send a message via MSN to Iron_Cross Send a message via Yahoo to Iron_Cross
Default

Ok, you'd probably have to use the Process or ProcessStartInfo classes. You'd send in the program "netstat" as the program to execute along with the arguments. You'd also have to add a special argument to redirect the output ("netstat -an > someFile.txt") then on the Process class you'd call the WaitForExit() method. Then you'd open and read all the contents of that file into your text area.

That would probably be the easiest way to do it.

It'd look something like this:
Code:
ProcessStartInfo l_psi = new ProcessStartInfo("Netstat");
l_psi.Arguments = "-an > SomeFile.txt";

Process.Start(l_psi);
Process.WaitForExt();

// Read in the contents of the SomeFile.txt here
// and print it to the text area

__________________

See today\'s Penny-Arcade!(May contain foul lanuage)
Pain is weakness leaving the body.

PM Me for my MSN
Iron_Cross is offline