求改IP的批处理代码

来源:百度知道 编辑:UC知道 时间:2024/05/08 09:09:58
现使用AD,但每当需要更改IP地址时,就必须重启路由器,百度查了很多,但不能用。现求一个能自动修改IP的批处理,点击就能改变IP,若可用,送分50

netsh int ip set address name="本地连接" source=static addr=192.168.1.1

@echo off&&setlocal enabledelayedexpansion
:start
set ip=1
:loop
set /a ip+=1
ping 192.168.1.!ip! -n 1&&goto loop||goto addit
:addit
echo 要把IP换成192.168.1.!ip!。
pause>nul
netsh interface ip set address name="本地连接" source=static addr=192.168.1.!ip! mask=255.255.255.0 gateway=192.168.1.1 gwmetric=auto
if !ip! gtr 254 goto top
goto loop

::另存为ChangeIP.bat运行