How to Write a Script to Ping Every 5 Minutes

The ping command sends several small packets of information from your computer to the designated target in an effort to determine if the target computer is online or offline. A normal ping command runs every second, but if you want to make a custom script to ping a target every five minutes, you can do so by creating a batch file.

Video of the Day

Businessman on phone at desk
credit: Jupiterimages/Polka Dot/Getty Images


Open Notepad, WordPad or your favorite text editor.


Create a new file and save it on your computer with the ".bat" file extension, which is a batch file script.


Type the following four commands into the text file, each on a separate line, in order:

:begin ping server_to_ping sleep 300 goto :begin


Save the batch file and then double-click on it. The ping command runs, pinging the "server_to_ping" every 300 seconds. Be sure to substitute the server IP address or name in the script for the "server_to_ping" example before you run the script.

Show Comments