2.切换以太网配置(动静态IP切换)

2024-02-25  本文已影响0人  狼少丷
练习原因

是因为公司内网为每个人分配了固定的IP等, 但是回家之后还要单独配置, 反复麻烦!


image.png
@echo off
:start
echo 1.内网(静态 IP)
echo 2.互联网(动态IP)
set /P var="请选择需要的功能序号:"
if %var%==1 goto ip1
if %var%==2 goto ip2
:ip1
cls
rem 根据自己的情况修改下列网络配置
netsh interface ip set address "以太网" static 192.168.x.xxx 255.255.0.0 192.168.xxx.x
netsh interface ip set dns "以太网"  static 202.xx.xxx.xx validate=no
netsh interface ip add dns "以太网" 202.xx.xxx.xx 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
上一篇下一篇

猜你喜欢

热点阅读