110,566
社区成员
发帖
与我相关
我的任务
分享
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;
p.Start();
p.StandardInput.WriteLine("ping -a bbs.csdn.net");
p.StandardInput.WriteLine("exit");
string strRst = p.StandardOutput.ReadToEnd();
Regex r = new Regex(@"Pinging (\S*)");
MsgBox(r.Match(strRst).Groups[1].Value);
using System.Threading;
using System.Diagnostics;
using System.Text.RegularExpressions;