Hack Forums
[Shell] Simple Internet Connection Checker - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Shell] Simple Internet Connection Checker (/showthread.php?tid=5166662)



Simple Internet Connection Checker - Motioncity13 - Feb 11, 2016

Sometimes people have DNS issues where they don't really know if they're connected to the internet or not; and I wrote this purely out of boredom in two minutes.

Code
@echo off
title Check Internet Status
:A
ping google.com -l 100 -n 1 >nul
if "%errorlevel%"=="0" (
goto chkS ) ELSE (
color 0c
echo Internet Connection: Non-Existent.
timeout /nobreak /t 1 >nul
cls
goto A)
:chkS
cls
color 0a
echo Internet Connection: Existent!
pause



* - jahwi - Feb 11, 2016

I'm also bored. Here's my version:
Code
@echo off
color a
::simple code that tries to determine the connection state by pinging a reliable domain like Google.
set mode=does not exist
title Simple Connection Checker
echo Determining Internet connection state...
ping www.google.com -n 5 >nul
if "%errorlevel%"=="0" set mode=exists
title Simple Connection Checker: Internet connection %mode%
pause



* - SavageAF - Feb 11, 2016

Or just open cmd and type ping google.com


* - jahwi - Feb 11, 2016

(Feb 11, 2016 11:26 AM)SavageAF Wrote:  Or just open cmd and type ping google.com
or ping www.facebook.com 😝


* - b00st3d - Feb 11, 2016

Here is my version I wrote last year some time.
https://hackforums.net/showthread.php?tid=4479308


I actually recently rewrote this in java to make it work better/easier.
This isn't batch so I'm hiding it here (Click to View)