window自动切换ip的脚本

因为总要切换ip,所以百度了一下脚本

如下http://jingyan.baidu.com/article/d2b1d1029d21b95c7e37d4fa.html

动态ip

netsh interface ip set address name="本地连接" source=dhcp
netsh interface ip set dns name="本地连接" source=dhcp

静态

netsh interface ip set address name="本地连接" source=static addr=10.1.112.65 mask=255.255.0.0 gateway=10.1.112.2
netsh interface ip set dns name="本地连接" source=static addr=114.114.114.114

需要注意的是:保存脚本的时候需要以ANSI格式保存,否则会出错