快速设置IP、DNS等信息的bat脚本
设置具体IP、DNS等信息
@echo off set name="WLAN" set ipaddress=192.168.36.107 set mask=255.255.255.0 set gateway=192.168.36.254 set dns=172.16.20.150 echo. echo 本次网络设置如下: echo IP地址:%ipaddress% echo 子网掩码:%mask% echo 默认网关:%gateway% echo 首选DNS:%dns% netsh interface ip set address name=%name% source=static addr=%ipaddress% mask=%mask% gateway=%gateway% 1 netsh interface ip set dns name=%name% source=static addr=%dns% register=primary > nul @pause
设置DHCP自动分配
@echo off netsh interface ip set address name="WLAN" source=dhcp netsh interface ip set dns name="WLAN" source=dhcp
参考链接:
https://blog.csdn.net/yyxaf/article/details/7289073
https://jingyan.baidu.com/article/ae97a646b7fcabbbfc461d4c.html