我用C#写了个清空IP同时更新IP的小程序,但只能清空不能更新请帮忙看看
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
namespace Myip
{
class Program
{
static void Main(string[] args)
{
CmdIpconfig();
}
private static void CmdIpconfig()
{
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("ipconfig/release");
p.StandardInput.WriteLine("ipconfig/renew");
p.StandardInput.WriteLine("exit");
p.Close();
}
}
}