就是通过C#写程序能得到ipconfig,ping,arp等的信息。
非常感谢!

解决方案 »

  1.   

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

  2.   

    试了一下 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");