IP Config release renew

December 19, 2011 at 05:44:45
Specs: Windows XP
i want a batch script which will release the ipconfig when internet is connected and renew the ipconfig when internet is disconnected

when i execute a batch file and if internet is connected the ipconfig should be released and if ipconfig is released it should be renewed..

The snippet:'(Doesnt work):
@echo off
ipconfig /release
echo
echo The IP address has been released. Waiting to renew…
echo
ipconfig /renew
echo The IP address has been renewed

Its releasing and renewing the ipconfig i want it either release or renew..thank you


See More: IP Config release renew

Report •


#1
December 20, 2011 at 05:47:53
Untested;

@echo off
:CHECK
cls
echo.
echo Internet connection detecter.
echo.
echo Press any key to start..
pause>nul
ping www.google.com -n 1 > nul
if %errorlevel%==0 goto OK
goto NOTOK

:OK
cls
echo Internet connection is ok.
echo.
echo Releasing internet connection..
echo.
pause
ipconfig /release
goto CHECK

:NOTOK
cls
echo Internet connection is not ok.
echo.
echo Renewing internet connection..
echo.
pause
ipconfig /renew
goto CHECK

Happy is ONE who says I am an OttoMAN.


Report •
Related Solutions


Ask Question