CODE: [Copy to clipboard]
@echo off
::抓取老IP
for /f "tokens=2 delims=:" %%i in ('ipconfig ^| findstr "Address" ^| findstr /v "192.168"') do @set oldip=%%i
echo 现在的IP地址是%oldip%,确认要重拨以进行IP更换吗?输入y回车继续
set /P goon=
if not pc%goon%==pcy goto :eof
::开始循环处
:start
rasdial adsl /DISCONNECT
ping 127.0.0.1 -n 2 >nul
echo 重拨ing...
rasdial adsl ad4148414 pspsljljhaha
for /f "tokens=2 delims=:" %%i in ('ipconfig ^| findstr "Address" ^| findstr /v "192.168"') do @set newip=%%i
if %newip%==%oldip% (
echo 新拨得IP与老IP一致,重来!
goto :start
)
echo 换IP成功,现在的IP是:%newip%
echo 按任意键退出
set oldip=
set newip=
set goon=
pause&exit
[