@echo off
cls
::set NAME="本地连接"
set NAME="无线网络连接"
set IP=192.168.1.55
set MASK=255.255.255.0
set GATEWAY=192.168.1.1
set DNS1=42.120.21.30
set DNS2=114.114.114.114
echo.
echo 自动获取IP 请按 1
echo.
echo 手动设置IP 请按 2
set /p KEY= [您的选择是:]
if %KEY% == 1 goto ONE
if %KEY% == 2 goto TWO
:TWO
ECHO 您选择了手动设置IP。
ECHO.
netsh interface ip set address name=%NAME% static %IP% %MASK% %GATEWAY%
netsh interface ip set dns %NAME% %DNS1% index=1
netsh interface ip set dns %NAME% %DNS1% index=2
echo IP地址已经设定修改完毕,按任意键关闭此窗口
pause
exit
:ONE
ECHO 您选择了自动获取IP。
ECHO.
netsh interface ip set address name=%NAME% dhcp
netsh interface ip set dns %NAME% dhcp
::netsh interface ip add dns %NAME% %DNS1% index=1
::netsh interface ip add dns %NAME% %DNS1% index=2
echo IP地址已经设定修改完毕,按任意键关闭此窗口
pause
exit