Windows 10

How to Check Internet Connection using Batch File

In this tutorial, we are going to see how to check internet connection using batch file. Batch file contains a series of DOS (Disk Operating System) instructions. It allows triggering the execution of commands found in this file.
 

How to Check Internet Connection using Batch File

In the following example, we have made a ping to google.com. If return success display “You are connected to the internet” else display “You are not connected to the internet”:

@echo off

Ping www.google.com -n 1 -w 1000 > null

if errorlevel 1 (echo You are not connected to the internet) else (echo You are connected to the internet)

Output:

You are connected to the internet

Leave a Reply

Your email address will not be published. Required fields are marked *