Board logo

标题: [网络连接] 求批处理更改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 编辑

自行修改
  1. set name=本地连接
  2. set ip=192.168.1.125
  3. set mask=255.255.255.0
  4. set gateway=192.168.1.1
  5. set dns1=8.8.8.8
  6. set dns2=114.114.114.114
  7. ver|find "5.1" >nul&&goto XP||goto Other
  8. :XP
  9. netsh interface ip set address name="%name%" source=static addr=%ip% mask=%mask% gateway=%gateway%
  10. netsh interface ip set dns name="%name%" source=static addr=%dns1% register=PRIMARY
  11. netsh interface ip add dns name="%name%" addr=%dns2% index=2
  12. pause&exit
  13. :Other
  14. netsh interface ipv4 set address name="%name%" source=static address=%ip% mask=%mask% gateway=%gateway%
  15. netsh interface ipv4 set dnsservers name="%name%" source=static address=%dns1% register=primary
  16. netsh interface ipv4 add dnsservers name="%name%" address=%dns2% index=2
  17. pause&exit
复制代码





欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2