using (Process process = new System.Diagnostics.Process()) { process.StartInfo.FileName = "ping"; process.StartInfo.Arguments = "www.ymind.net"; // 必须禁用操作系统外壳程序 process.StartInfo.UseShellExecute = false; process.StartInfo.CreateNoWindow = true; process.StartInfo.RedirectStandardOutput = true;
process.Start();
string output = process.StandardOutput.ReadToEnd();
if (String.IsNullOrEmpty(output) == false) this.textBox1.AppendText(output + "\r\n");
process.WaitForExit(); process.Close(); }