@echo off
REM echo 使用ansi格式编码
:ch
cls
:set
echo *************************************
echo ** 1.设置普通dhcp模式 *
echo ** 2.设置**办公网静态ip模式 *
echo ** 3.Exit *
echo *************************************
set /p a=请选择1或2:
if "%a%" == "1" goto 1
if "%a%" == "2" goto 2
if "%a%" == "3" goto 3
goto ch
:1
echo 1.设置普通dhcp模式 IP and DNS
netsh interface ip set address name="本地连接" source=dhcp
netsh interface ip set dns name="本地连接" source=dhcp
goto show
:2
echo 2.设置**办公网静态ip模式
netsh interface ipv4 set address name="本地连接" source=static addr=140.1.2.187 mask=255.255.255.0 gateway=140.1.2.1 gwmetric=0
goto show
:show
echo Display the new config....
netsh interface ipv4 show ipaddress 13
echo .
echo .
echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
goto set
:3
exit
REM set address name="Wired Ethernet Connection" source=dhcp
REM set address "Wired Ethernet Connection" static 10.0.0.9 255.0.0.0 10.0.0.1 1
转载于:https://my.oschina.net/fscoiety/blog/649086