netsh interface ip set address name="本地连接" source=static addr=10.160.13.55 mask=255.255.255.0
netsh interface ip set address name="本地连接" gateway=10.160.13.254 gwmetric=0
netsh interface ip set dns name="本地连接" source=static addr=10.1.3.5 register=PRIMARY
netsh interface IP set address "本地连接" static 138.8.8.111 255.255.255.0 138.8.8.1 1
echo IP地址切换程序
echo ----------------------------
echo 更换为20的IP,请按 [h]
echo.
echo 更换为51的IP,请按 [g]
echo 按其他任意键退出 程序。
echo ----------------------------
set /p ch= 请根据上面提示输入:
netsh interface ip set address name="本地连接" source=static addr=192.168.20.250 mask=255.255.255.0
::设置IP为192.168.20.250 ,子网掩码为255.255.255.0
netsh interface ip set address name="本地连接" gateway=192.168.20.254 gwmetric=0
netsh interface ip set dns name="本地连接" source=static addr=168.95.1.1 register=PRIMARY
netsh interface ip add dns name="本地连接" addr=202.96.128.143 index=2
netsh interface ip set address name="本地连接" source=static addr=192.168.51.29 mask=255.255.255.0
::设置IP为192.168.50.50 ,子网掩码为255.255.255.0
netsh interface ip set address name="本地连接" gateway=192.168.51.254 gwmetric=0
netsh interface ip set dns name="本地连接" source=static addr=168.95.1.1 register=PRIMARY
netsh interface ip add dns name="本地连接" addr=202.96.128.143 index=2
子网掩码(mask=255.255.255.0 >nul)
默认网关(netsh interface ip set address name="本地连接" gateway=192.168.1.1 gwmetric=0 >nul)
首选DNS服务器(netsh interface ip set dns name="本地连接" source=static addr=0.0.0.0 register=PRIMARY >nul)
备用DNS服务器(netsh interface ip add dns name="本地连接" addr=0.0.0.0 index=2 >nul)
rem 主要用于在计算所内部ip和宿舍ip自动切换
rem **************************************************
set config=%SystemRoot%\System32\ipconfig.exe
echo ╭──────┤ IP地址自动设置程序 ├──────╮
echo │ ╰─────────────╯ │
echo │本程序能为您自动或手动设置合适的IP,网关及DNS │
echo │ Design By: 浪子回头│
echo ╰───────────────────────────╯
echo 1. 设置成计算所静态IP
echo 2. 设置成宿舍动态ip
echo Q. 退出
echo ==========================================================
if /I "%type%"=="1" goto :goictstatic
if /I "%type%"=="2" goto :godormdyn
if /I "%type%"=="Q" goto :end
echo 将IP地址设置成 192.168.1.0
echo 子网掩码设置成 255.255.255.0
echo 网关地址设置成 192.168.1.0
echo DNS:202.96.128.166
echo 正在设置IP地址及子网掩码
netsh interface ip set address name="本地连接" source=static addr=192.168.1.0 mask=255.255.255.0 >nul
echo 正在设置默认网关地址
netsh interface ip set address name="本地连接" gateway=192.168.1.0 gwmetric=0 >nul
echo 正在设置DNS
netsh interface ip set dns name="本地连接" source=static addr=202.96.128.166 register=PRIMARY >nul
netsh interface ip add dns name="本地连接" addr=0.0.0.0 index=2 >nul
echo 按任一键退出程序!
netsh interface ip set address name="本地连接" source=static addr=192.168.1.2 mask=255.255.255.0 gateway=192.168.1.1 gwmetric=auto
netsh interface ip set dns name="本地连接" source=static addr=210.52.149.2 register=primary
netsh interface ip set dns name="本地连接" addr=202.106.0.133 index=2
netsh interface ip set address name="本地连接" source=static addr=192.168.81.164 mask=255.255.255.0 gateway=192.168.81.1 gwmetric=auto
netsh interface ip set dns name="本地连接" source=static addr=192.168.80.21 register=primary
if %gw%==none netsh interface ip set address %eth% static %ip% %netmasks% %gw% > nul
if not %gw%==none netsh interface ip set address %eth% static %ip% %netmasks% %gw% 1 > nul
echo 设置开始自动IP,请稍等....
echo 正在自动获取IP地址....
netsh interface ip set address name = "本地连接" source = dhcp
netsh interface ip set address "本地连接" source = static addr = 192.168.1.3 mask=255.255.255.0
netsh interface ip set address "本地连接" gateway = 192.168.1.1 gwmetric =1
netsh interface ip set dns "本地连接" source = static addr = 211.98.2.4
@ echo offrem 设置变量set Nic=本地连接 rem //可以根据你的需要更改,set Add=192.168.1.177echo ------------------------------------------------------echo 对于不连入局域网的ADSL用户,建议填写IP地址,
echo ------------------------------------------------------
netsh interface ip set address name=%Nic% source=static addr=%add% mask=255.255.255.0
echo ------------------------------------------------------
转载于:https://blog.51cto.com/bubble/785866