快速切换与自定义IP地址

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

@echo off
:0
echo.---------------------------------------------
echo.输入1设置自动获取IP地址
echo.输入2设置为192.168.1.251
echo.输入3设置为192.168.2.251

echo.输入4为自动获取DNS
echo.输入5为修改DNS设置到谷歌IP=8.8.8.8
echo.输入6为修改DNS设置到四川电信IP=61.139.2.69
echo.输入7为手动设置IP
echo.输入8为手动设置DNS
echo.输入9结束操作
echo.---------------------------------------------
set /p id=请输入相应数字:

if %id%==1 goto :1
if %id%==2 goto :2
if %id%==3 goto :3
if %id%==4 goto :4
if %id%==5 goto :5
if %id%==6 goto :6
if %id%==7 goto :7
if %id%==8 goto :8
if %id%==9 goto :9

:1
netsh interface ip set address name="本地连接" source=DHCP
goto :0
exit

:2
netsh interface ip set address name="本地连接" source=static addr=192.168.1.251 mask=255.255.255.0 gateway=192.168.1.1 gwmetric=1
goto :0

:3
netsh interface ip set address name="本地连接" source=static addr=192.168.2.251 mask=255.255.255.0 gateway=192.168.2.1 gwmetric=1
goto :0

:4
netsh interface ip set dns name="本地连接" source=DHCP
goto :0

:5
netsh interface ip set dns name="本地连接" source=static addr=8.8.8.8
goto :0
:6
netsh interface ip set dns name="本地连接" source=static addr=61.139.2.69
goto :0

:7
set /p addr=address:
set /p mask=mask:
set /p gate=geteway:
netsh interface ip set address name="本地连接" source=static addr=%addr% mask=%mask% gateway=%gate% gwmetric=1
goto :0
:8
SET /P dns=DNS:
netsh interface ip set dns name="本地连接" source=static addr=%dns%
goto :0
:9
exit