本帖最后由 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
复制代码
|