@echo off
mode con cols=80 lines=10&color 0d
title IP 切换设置
:st
cls
echo.
echo        1.(自动保存IP到D盘) 2.(设置上网IP) 3.(还原IP设置)
echo.
set /p ip=请输入:
echo.
if %ip%==1 goto zd
if %ip%==2 goto sd
if %ip%==3 goto sd2
echo|set /p a=输入错误,请重新输入...&pause>nul&&goto st
:zd
netsh -c interface ip dump>d:/IP.txt
echo 保存完毕...
pause
goto st
exit
:sd
netsh interface ip set address "本地连接" static 172.24.88.88 255.255.0.0 172.24.1.1 1
::后面网关最后的1是跳跃数,不能省略
netsh interface ip set DNS   "本地连接" static 172.24.1.197
netsh interface ip add dns   "本地连接" 172.21.1.252 index=2
if exist %SystemRoot%\setupapi.log del /q %SystemRoot%\setupapi.log
echo 设置完毕...
pause
goto st
exit

:sd2
netsh exec d:/IP.txt
::或者netsh -f d:/IP.txt
if exist %SystemRoot%\setupapi.log del /q %SystemRoot%\setupapi.log
echo 还原完毕...
pause
rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,1
exit

:err
echo.
echo 手动设置失败
echo|set /p a=请检查一下IP输写是否正确...
pause>nul
goto st