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.Start();
p.StandardInput.WriteLine(@"ping www.qq.com"); //在这里可以写多行dos命令
p.StandardInput.WriteLine(@"ping www.baidu.com");
string strRst = p.StandardOutput.ReadToEnd();
p.Close();