//开设一个进程
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
string pingrst;
p.Start();
p.StandardInput.WriteLine("net user”);//异步执行
p.StandardInput.WriteLine("exit");
string strRst = p.StandardOutput.ReadToEnd();
以后分析字符串strRst即可