Windows下自动设置本地连接的IP地址脚本
netsh interface ip set address name="local" source=dhcp
netsh interface ip set dns name="local" source=dhcp
2、netsh interface ip set address 本地连接 static 192.168.1.150 255.255.252.0 192.168.1.1
netsh interface ip set address local static 192.168.1.150 255.255.252.0 192.168.1.1?
@netsh interface ip set dns local 192.168.0.254
@netsh interface ip add dns local 202.106.196.115 index=2
@netsh interface ip add dns local 202.106.0.20 index=3
3、netsh interface ip set address 本地连接 static 110.1.1.150 255.0.0.0 110.1.1.1
netsh interface ip set address local static 110.1.1.150 255.0.0.0 110.1.1.1
1. 设置IP,子网掩码,网关:
netsh interface ip set address 本 static 202.121.24.37 255.255.255.0 202.121.24.1
其中,也可以写成 “本地连接”,要是英文操作系统恐怕要写作 “local”。 202.121.24.37 是IP地址, 255.255.255.0 为子网掩码,202.121.24.1 是网关。
2. 设置DNS和备用DNS:
netsh interface ip set dns 本 static 202.121.20.100
设置备用DNS,需要把 set 换成 add ,同时将 static 去掉:
netsh int ip add dns 本 202.121.20.200
example:
ip=110.1.1.111
netsh interface ip set address 本地连接 static 110.1.1.111 255.0.0.0 110.1.1.1
@netsh interface ip set dns 本地连接 110.1.1.88
ip=192.168.1.150
netsh interface ip set address 本地连接 static 192.168.1.150 255.255.255.0 192.168.1.1
@netsh interface ip set dns 本地连接 192.168.1.1
ip自动获取
netsh interface ip set address name="本地连接" source=dhcp
netsh interface ip set dns name="本地连接" source=dhcp
Windows IP配置脚本

本文介绍了一种在Windows环境下通过批处理脚本自动配置网络适配器IP地址的方法。包括如何使用netsh命令手动设置静态IP地址、子网掩码、默认网关及DNS服务器,同时也介绍了如何恢复到自动获取IP地址的状态。
1397

被折叠的 条评论
为什么被折叠?



