DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: Configurable batch code to launch a web after check internet connection  (Read 3,972 times)

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Configurable batch code to launch a web after check internet connection

My idea is schedule this bat file able to launche a website or any similar task after checking the internet conection.
If not active internet connection keep trying until success.

Best Regards
:-*

4wd

  • Pedantic Old Bastard
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,652
    • Coding Snacks
Code: (generic)
rem Check Internet connection, if not found loops every 30 seconds
rem Adapted from:
rem http://stackoverflow.com/questions/6357515/batch-files-using-ping-to-test-network-connectivity
@echo off
set site=www.google.com
:loop
ping www.google.com -n 1 -w 5000 > nul
if errorlevel 1 (
  ping -n 30 127.0.0.1 > nul
  goto loop
  )
elseif (
  start http://%site%
  )

FYI
"I will not follow where the path may lead, but I will go where there is no path, and I will leave a trail." - Muriel Strode, 1903

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Wonderful
Thanks a lot

Best Regards

Original address: https://www.donationcoder.com/forum/index.php?topic=40776.0