办公室固定IP/DHCP快速切换脚本
Windows下的更改IP的批处理V1.0版
1 @echo off 2 :: 修改后面的序号为你的IP的后缀: 3 set ip=25 4 5 :start 6 echo ============请输入数字选择下一步操作: 7 echo ============1:ip设置为192.168.0.%ip% 8 echo ============0:设置为DHCP自动获取ip 9 set /P var="请输入编号[1,0]:" 10 if %var%==1 goto ip10 11 if %var%==0 goto ipdhcp 12 13 :ip10 14 cls 15 netsh interface ip set address name="无线网络连接" source=static addr=192.168.0.%ip% mask=255.255.255.0 gateway=192.168.0.1 >> nul 16 netsh interface ip set dns name="无线网络连接" source=static addr=223.5.5.5 register=PRIMARY >> nul 17 echo **IP设置为192.168.0.%ip%,设置成功** 18 echo ------------------------------------------ 19 echo 按任意键关闭 20 pause >> nul 21 goto end 22 23 :ipdhcp 24 cls 25 netsh interface ip set address name="无线网络连接" source=dhcp >> nul 26 netsh interface ip delete dns "无线网络连接" all >> nul 27 ipconfig /flushdns >> nul 28 echo **IP设置为DHCP获取,设置成功** 29 echo ------------------------------------------ 30 pause 31 goto end 32 33 :end 34 exit 0