请问我怎么把在命令模式输入ipconfig/all的信息通过C#读入到textbox或者其它控件,谢谢!

Angelnet 2005-06-01 06:03:21
就是通过C#写程序能得到ipconfig,ping,arp等的信息。
非常感谢!
...全文
108 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
alexxzr 2005-06-02
  • 打赏
  • 举报
回复
哦!谢谢啊!
CCsdnCC 2005-06-02
  • 打赏
  • 举报
回复
试了一下 chenyuming2004(这辈子我算是废了) 的方法,觉得应该改进一下:
System.Diagnostics.Process p=new System.Diagnostics.Process();
p.StartInfo.UseShellExecute=false;
p.StartInfo.RedirectStandardInput=true;
p.StartInfo.RedirectStandardOutput=true;
p.StartInfo.CreateNoWindow=true;
p.StartInfo.FileName="ipconfig.exe";
p.StartInfo.Arguments = "/all";
p.Start();
string Text=p.StandardOutput.ReadToEnd();
p.WaitForExit();
// p.StartInfo.FileName="cmd.exe";
// p.StandardInput.Write("ipconfig /all\r\n");
// p.StandardInput.Write("exit\r\n");
chenyuming2004 2005-06-02
  • 打赏
  • 举报
回复
System.Diagnostics.Process p=new System.Diagnostics.Process();
p.StartInfo.UseShellExecute=false;
p.StartInfo.RedirectStandardInput=true;
p.StartInfo.RedirectStandardOutput=true;
p.StartInfo.CreateNoWindow=true;
p.StartInfo.FileName="cmd.exe";
p.Start();
p.StandardInput.Write("ipconfig /all\r\n");
p.StandardInput.Write("exit\r\n");
textBox1.Text=p.StandardOutput.ReadToEnd();

110,537

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧