@echo off REM 设置变量 set ip1=192.168.0.1 set ip2=192.168.1.1 set ip3=192.168.2.1 set ip4=192.168.3.1 set ip5=192.168.4.1

REM 显示菜单 echo 请选择要切换的IP地址: echo 1. %ip1% echo 2. %ip2% echo 3. %ip3% echo 4. %ip4% echo 5. %ip5% echo 6. 自动获取IP地址 set /p choice=输入菜单编号:

REM 执行命令 if '%choice%'=='1' ( netsh interface ipv4 set address name='本地连接' static %ip1% 255.255.255.0 192.168.0.1 ) else if '%choice%'=='2' ( netsh interface ipv4 set address name='本地连接' static %ip2% 255.255.255.0 192.168.1.1 ) else if '%choice%'=='3' ( netsh interface ipv4 set address name='本地连接' static %ip3% 255.255.255.0 192.168.2.1 ) else if '%choice%'=='4' ( netsh interface ipv4 set address name='本地连接' static %ip4% 255.255.255.0 192.168.3.1 ) else if '%choice%'=='5' ( netsh interface ipv4 set address name='本地连接' static %ip5% 255.255.255.0 192.168.4.1 ) else if '%choice%'=='6' ( netsh interface ipv4 set address name='本地连接' dhcp ) else ( echo 无效的菜单编号! pause exit )

REM 显示设置的IP地址信息 echo. echo 当前IP地址信息: ipconfig | findstr IPv4 echo. pause

批处理脚本:一键切换不同网段IP地址

原文地址: https://www.cveoy.top/t/topic/nsQp 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录