c#调用cmd命令为什么速度慢

 我来答
畅快又典雅灬小鲤B
2017-12-18 · TA获得超过1.7万个赞
知道小有建树答主
回答量:4万
采纳率:13%
帮助的人:1977万
展开全部
private void button1_Click(object sender, EventArgs e)
{
try
{
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 172.16.1.1");
p.StandardInput.WriteLine("exit");
string strRst = p.StandardOutput.ReadToEnd();
p.WaitForExit();
this.label1.Text = strRst;
}
catch (Exception err)
{
MessageBox.Show(err.Message); //显示错误信息。
}
}
通过了一个.Net 当然慢了
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式