Console Commands from Windows App
Posted on 2004-09-27
The following code runs when I press a command button in a Windows App:
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.FileName = "cmd";
process.StartInfo.Arguments = "/c nbtstat -a COMPUTERNAME";
process.StartInfo.UseShellExecute = false;
When the console opens it quickly executes the "nbtstat -a computer" command and then disappears. How do I keep that console window open to see the return results of the nbtstat command, and then close it on a keypress? Something like, getch() in C++ I'd guess....?