C# Process

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();  }

posted @ 2012-07-23 17:25  杨斌_济南  阅读(301)  评论(0编辑  收藏  举报