在form下调用ping命令的方法
2011-07-12 10:56 qinuo 阅读(185) 评论(0) 编辑 收藏 举报刚学c#没多久,所以只了解一些基本知识,我是做电话录音系统的,就是电话录音卡,电话录音盒相关的软件,以及驱动,这方面的知识有时候也用得着,所以说,我要好好学习此类语言,呵呵,先说方法吧:
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(orderstr);
p.StandardInput.WriteLine("exit");
string strRst = p.StandardOutput.ReadToEnd();
希望对想学c#的童鞋,有所帮助。