这是一个基本的批处理程序,它可以切换本地计算机的IP地址。请注意,这个程序假定您的计算机有5个预设的IP地址,每个IP地址都有相同的DNS和子网掩码。此外,一个IP地址是通过DHCP自动获取的。

@echo off set /p choice=Enter the number of the IP address you want to switch to (1-5): if %choice%==1 ( netsh interface ipv4 set address name="Local Area Connection" static 192.168.1.10 255.255.255.0 192.168.1.1 echo IP address switched to 192.168.1.10 ) else if %choice%==2 ( netsh interface ipv4 set address name="Local Area Connection" static 192.168.1.11 255.255.255.0 192.168.1.1 echo IP address switched to 192.168.1.11 ) else if %choice%==3 ( netsh interface ipv4 set address name="Local Area Connection" static 192.168.1.12 255.255.255.0 192.168.1.1 echo IP address switched to 192.168.1.12 ) else if %choice%==4 ( netsh interface ipv4 set address name="Local Area Connection" static 192.168.1.13 255.255.255.0 192.168.1.1 echo IP address switched to 192.168.1.13 ) else if %choice%==5 ( netsh interface ipv4 set address name="Local Area Connection" dhcp echo IP address switched to DHCP ) else ( echo Invalid choice. Please enter a number between 1 and 5.

计算机专家 演示一个 批处理 程序 用于切换本地的5个预先保存在 批处理里面的 IP地址 但有相同的dns 和子网掩码 和一个通过dhcp 自动获取的方式

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

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