在需要经常切换Local Area Connection的IP设置的时候,使用如下两组命令做两个批处理文件,能使操作简化很多。
1. 设置为固定IP和DNS
netsh int ip set address name="Local Area Connection" source=static address=192.168.73.59 mask=255.255.255.0 gateway=192.168.73.1 gwmetric=1
netsh int ip set dns name="Local Area Connection" source=static addr=218.85.157.99
netsh int ip add dns name="Local Area Connection" addr=110.90.119.99
2. 设置为使用DHCP
netsh int ip set address name="Local Area Connection" source=dhcp
netsh int ip set dns name="Local Area Connection" source=dhcp