标题: [网络连接] 求批处理更改IP地址、网关、子网掩码及DNS,xp/win7/win8通用 [打印本页]
作者: 16381584 时间: 2015-8-30 23:26 标题: 求批处理更改IP地址、网关、子网掩码及DNS,xp/win7/win8通用
本帖最后由 pcl_test 于 2016-11-24 16:48 编辑
winxp和win7win8通用
作者: DAIC 时间: 2015-8-31 10:02
netsh interface ip
作者: pcl_test 时间: 2015-8-31 10:49
本帖最后由 pcl_test 于 2016-12-16 17:57 编辑
自行修改- set name=本地连接
- set ip=192.168.1.125
- set mask=255.255.255.0
- set gateway=192.168.1.1
- set dns1=8.8.8.8
- set dns2=114.114.114.114
- ver|find "5.1" >nul&&goto XP||goto Other
- :XP
- netsh interface ip set address name="%name%" source=static addr=%ip% mask=%mask% gateway=%gateway%
- netsh interface ip set dns name="%name%" source=static addr=%dns1% register=PRIMARY
- netsh interface ip add dns name="%name%" addr=%dns2% index=2
- pause&exit
- :Other
- netsh interface ipv4 set address name="%name%" source=static address=%ip% mask=%mask% gateway=%gateway%
- netsh interface ipv4 set dnsservers name="%name%" source=static address=%dns1% register=primary
- netsh interface ipv4 add dnsservers name="%name%" address=%dns2% index=2
- pause&exit
复制代码
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |