How to Write a Script to Ping Every 5 Minutes

Techwalla may earn compensation through affiliate links in this story. Learn more about our affiliate and product review process here.
Image Credit: Jupiterimages/Polka Dot/Getty Images

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.


Step 1

Open Notepad, WordPad or your favorite text editor.

Video of the Day

Step 2

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

Step 3

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


Step 4

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.




Report an Issue

screenshot of the current page

Screenshot loading...