切到静态地址
@echo off
echo ***********************************
echo * modify to static ip *
echo ***********************************
echo start change ip addr .....
netsh interface ipv4 set address name="无线网络连接" source=static addr=192.168.2.111 mask=255.255.255.0 gateway=192.168.2.1 gwmetric=0
echo start change dns ....
netsh interface ipv4 set dns name="无线网络连接" source=static addr=114.114.114.114 register=PRIMARY
pause
切到动态地址
@echo off
echo ***********************************
echo * modify to dhcp ip *
echo ***********************************
echo start change ip addr .....
netsh interface ipv4 set address name="无线网络连接" source=dhcp
echo start change dns ....
netsh interface ipv4 set dns name="无线网络连接" source=dhcp
pause
- 注意:批处理文本存储时一定要是gbk(gb2312)编码,不然会出现问题