将下面代码保存成.bat脚本文件后将编码改成ANSI
以管理员身份运行:
@echo off
:start
echo 1、内网(静态IP)
echo 2、互联网(动态IP)
set /P var="请输入你选择地点对应的数字:"
if %var%==1 goto ip1
if %var%==2 goto ip2
:ip1
cls
netsh interface ip set address "以太网" static 172.18.22.66 255.255.255.0 172.18.22.1
netsh interface ip set dns "以太网" static 12.12.1.1 validate=no
netsh interface ip add dns "以太网" 10.10.1.1 validate=no
ipconfig /flushdns
echo ** 切换内网静态IP **
echo ------------------------------------------
pause
exit
goto start
:ip2
cls
netsh interface ip set address "以太网" dhcp
netsh interface ip set dns "以太网" dhcp
ipconfig /flushdns
echo ** 切换互联网动态IP **
echo ------------------------------------------
pause
exit