IP地址快速切换bat
@echo off
cls
color 0A
echo *****************************
echo IP地址快速切换
echo 作者:ITIndex.net
echo 版本:1.0
echo *****************************
:MENU
echo.
echo 天河基地设置请按 1
echo.
echo 家里设置请按 2
echo.
echo 供电局设置请按 3
echo.
echo 呼叫中心设置请按 4
echo.
echo 退出请按任意键
echo.
echo *****************************
set /p KEY=请输入您的选择:
if %KEY% == 1 goto SET1
if %KEY% == 2 goto SET2
if %KEY% == 3 goto SET3
if %KEY% == 4 goto SET4
if %KEY% == "" goto END
:SET1
set IP=10.124.55.27
set MASK=255.255.254.0
set GATEWAY=10.124.55.1
set DNS1=10.150.129.36
set DNS2=88.148.1.36
set INTERFACE=本地连接
echo.
echo 1:IP地址及子网掩码设置
netsh interface ip set address name="%INTERFACE%" source=static addr=%IP% mask=%MASK%
echo 2:网关地址设置
netsh interface ip set address name="%INTERFACE%" gateway=%GATEWAY% gwmetric=0
echo 3:主DNS地址设置
netsh interface ip set dns name="%INTERFACE%" source=static addr=%DNS1% register=PRIMARY
echo 4:第二DNS地址设置
netsh interface ip add dns name="%INTERFACE%" addr=%DNS2% index=2
echo 5:天河基地设置成功!!!
goto END
:SET2
echo.
echo 1:快速设置IP地址为“自动获得”
netsh interface ip set address "本地连接" dhcp
echo 2:快速设置DNS为“自动获得”
netsh interface ip set dns "本地连接" dhcp
echo 3:家里设置成功!!!
goto END
:SET3
set IP=88.148.44.210
set MASK=255.255.254.0
set GATEWAY=88.148.44.1
set DNS1=10.150.129.36
set DNS2=88.148.1.36
set INTERFACE=本地连接
echo.
echo 1:IP地址及子网掩码设置
netsh interface ip set address name="%INTERFACE%" source=static addr=%IP% mask=%MASK%
echo 2:网关地址设置
netsh interface ip set address name="%INTERFACE%" gateway=%GATEWAY% gwmetric=0
echo 3:主DNS地址设置
netsh interface ip set dns name="%INTERFACE%" source=static addr=%DNS1% register=PRIMARY
echo 4:第二DNS地址设置
netsh interface ip add dns name="%INTERFACE%" addr=%DNS2% index=2
echo 5:供电局设置成功!!!
goto END
:SET4
set IP=172.18.16.102
set MASK=255.255.255.0
set GATEWAY=88.148.44.1
set DNS1=10.150.129.36
set DNS2=88.148.1.36
set INTERFACE=本地连接
echo.
echo 1:IP地址及子网掩码设置
netsh interface ip set address name="%INTERFACE%" source=static addr=%IP% mask=%MASK%
echo 2:网关地址设置
netsh interface ip set address name="%INTERFACE%" gateway=%GATEWAY% gwmetric=0
echo 3:主DNS地址设置
netsh interface ip set dns name="%INTERFACE%" source=static addr=%DNS1% register=PRIMARY
echo 4:第二DNS地址设置
netsh interface ip add dns name="%INTERFACE%" addr=%DNS2% index=2
echo 5:呼叫中心设置成功!!!
goto END
:END
echo.
pause