Using a batch file would it be possible to do something like:
ping google.com
if return success do ECHO You are connected to the internet
else return
Based on the answer from @CShulz, here's a script that'll print "Not connected" only when there's no connection, else it'll silently loop through the test every 30 seconds. First ping tests for connectivity & prints an error message if there's a problem. The second ping adds a 30 second wait by pinging the localhost.
@echo off
:loop
ping www.google.com -n 1 -w 5000 > nul
if errorlevel 1 echo Not connected
ping -n 30 127.0.0.1 > nul
goto loop