@echo off REM This batch file is used to switch between 5 different IP addresses on a local network REM with the same DNS and subnet mask. It also displays the current IP address before exiting.

REM Set the default IP address to DHCP netsh interface ip set address 'Local Area Connection' dhcp

REM Display the current IP address ipconfig | findstr /i 'IPv4 Address'

REM Menu to select a different IP address :MENU echo. echo Please select an IP address to use: echo. echo 1) 192.168.0.10 echo 2) 192.168.1.10 echo 3) 192.168.2.10 echo 4) 192.168.3.10 echo 5) 192.168.4.10 echo 6) Use DHCP (default) echo. set /p choice=Enter choice:

REM Set the selected IP address if '%choice%'=='1' netsh interface ip set address 'Local Area Connection' static 192.168.0.10 255.255.255.0 192.168.0.1 if '%choice%'=='2' netsh interface ip set address 'Local Area Connection' static 192.168.1.10 255.255.255.0 192.168.1.1 if '%choice%'=='3' netsh interface ip set address 'Local Area Connection' static 192.168.2.10 255.255.255.0 192.168.2.1 if '%choice%'=='4' netsh interface ip set address 'Local Area Connection' static 192.168.3.10 255.255.255.0 192.168.3.1 if '%choice%'=='5' netsh interface ip set address 'Local Area Connection' static 192.168.4.10 255.255.255.0 192.168.4.1 if '%choice%'=='6' netsh interface ip set address 'Local Area Connection' dhcp if '%choice%'=='' goto MENU

REM Display the new IP address echo. echo The new IP address is: ipconfig | findstr /i 'IPv4 Address'

REM Pause before exiting pause

Windows 批量脚本:轻松切换本地网络 IP 地址

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

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