快捷更改IP配置.bat脚本

@echo off

:list
echo 1. 动态
echo 2. 静态
echo 3. DHCP
echo 4. exit
echo 请选择序号:...
set /p n=
if %n% == 1 goto staticIP
if %n% == 2 goto dynamicIP
if %n% == 3 goto dhcp
if %n% == 4 exit

:staticIP
echo qinshi is here
netsh interface ip set address name="本地连接" source=dhcp
netsh interface ip set dns name="本地连接" source=dhcp
pause & exit

:dynamicIP
echo qiming is here
netsh interface ip set address name="本地连接" source=static addr=192.168.10.201 mask=255.255.255.0 gateway=192.168.10.254 gwmetric=1
netsh interface ip set dns name="本地连接" source=static addr=8.8.8.8 register=primary
netsh interface ip add dns name="本地连接" addr=202.114.0.242 index=2
echo ip:192.168.10.201
pause & exit

:dhcp
echo dhcp is here
netsh interface ip set address name="本地连接" source=dhcp
pause & exit

原文地址:https://www.cnblogs.com/goAhead-hust/p/4263821.html