netsh interface ip set address "以太网" dhcp netsh interface ip set dns "以太网" dhcp
netsh interface ip set address "以太网" static 10.10.30.94 255.255.255.0 10.10.30.254 1 netsh interface ip set dns "以太网" static 10.10.17.1
在C#中也可以调用这个命令执行设置操作。
1 2 3 4 5
Process p = new Process(); ProcessStartInfo psi = new ProcessStartInfo("netsh", "interface ip set address \"Local Area Connection\" static 192.168.0.10 255.255.255.0 192.168.0.1 1"); p.StartInfo = psi; p.Start();