@echo off
ipconfig /all | find "Default Gateway" >%temp%\sample.txt
FOR /F "eol=; tokens=13,13* delims=, " %%i in (%temp%\sample.txt) do set XXX=%%i
set username=Admin
set password=Admin
echo Set oShell = CreateObject("WScript.Shell") >%temp%\cc.vbs
echo oShell.run"telnet %XXX%" >>%temp%\cc.vbs
echo WScript.Sleep 1000 >>%temp%\cc.vbs
echo oShell.SendKeys "%username%" >>%temp%\cc.vbs
echo oShell.SendKeys("{Enter}") >>%temp%\cc.vbs
echo WScript.Sleep 1000 >>%temp%\cc.vbs
echo oShell.SendKeys "%password%" >>%temp%\cc.vbs
echo oShell.SendKeys("{Enter}") >>%temp%\cc.vbs
echo WScript.Sleep 1000 >>%temp%\cc.vbs
echo oShell.SendKeys "reboot" >>%temp%\cc.vbs
echo oShell.SendKeys("{Enter}") >>%temp%\cc.vbs
echo wscript.sleep 15000 >>%temp%\cc.vbs
echo oShell.run"tskill /a telnet" >>%temp%\cc.vbs
%temp%\cc.vbs
:yogi
ping
www.rapidshare.com | find "TTL"
IF ERRORLEVEL 1 (goto yogi)