脚本设置ip&自动获取ip

设置ip

netsh interface ip set address "本地连接 2" static 192.168.1.110 255.255.255.0 192.168.1.1 1
netsh interface ip add dns name="本地连接 2" addr=172.168.0.28

自动获取

netsh interface ip set dns name = "本地连接 2" static addr = none 
netsh interface ip set address name="本地连接 2" source=dhcp  

参考文献:http://blog.csdn.net/wuweilong/article/details/9841095

原文地址:https://www.cnblogs.com/Percy/p/4279840.html