home Tech How to make a batch file to test internet connection

How to make a batch file to test internet connection

Internet connectivity often fails,this can be highly disruptive when in middle of a critical task like say doing an online transaction.

Is there any way we can keep a track of our internet connection being stable especially before say performing an online transaction like online booking of an order?

There definitely is a way to do that from our computers,simply make a batch file and use a continuous ping command to keep pinging any website till you can see that there are no timeouts,if you see considerable request timed out messages,get in touch with internet service provider to get it fixed immediately.

A batch file is something that can execute commands in bulk without much human interaction,like a batch of jobs.A .bat file in Windows world is typically a file with commands that simply run once the file is run.

A ping test is used to check if a given computer can communicate with other computers or the outside world (like internet websites).
Seeing replies from the hosts/sites being pinged is a good sign,a sign that connection is active,any other error message means digging deeper to find out why.

I use a ping batch file that is run before I make any critical transactions online because even a small disruption might mean that your online transaction is halted or timed out which is not a pretty situation to be in.

Suppose you used credit card to make payment,then before actually checking out your online shopping cart,the website times out or even worse you click more than once making multiple payments.Of course online charges can be reversed but prevention is always better than cure]

Now let’s bring ping command and batch file together to make something cool.
Open a new text document (Start > Run > notepad),here we will make a ping batch file with infinite count (that is unless we terminate the ping ourselves).

Let’s say we ping a popular website like yahoo.com.To make a batch file,type :
ping yahoo.com -t (-t means keep pinging till stopped).

Now the important part is saving the text file (File > Save As) with a .bat extension as shown :

Make sure that Save as type is All Files and not the default .txt type,name the batch file something suitable and save it with extension .bat

That’s it,you now have your very own simple batch file which on double clicking will keeps pinging until you stop it.Press Ctrl-C and hit ‘y’ key to stop pinging and close the batch file.

Isn’t automating basic tasks like this a great time saver?

One thought on “How to make a batch file to test internet connection

Leave a Reply

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