Search code examples
windowsfilebatch-file

Batch Files - Using ping to test network connectivity


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 ECHO You are not connected to the internet


Solution

  • You can use following snippet:

    @echo off
    Ping www.google.de -n 1 -w 1000
    if errorlevel 1 echo Not connected