DISCOVER
×

How to Do a Continuous Ping With NMAP

Updated July 20, 2017

Many people don't know about the most powerful automation tool their computers have built-in --- batch files. Using Nmap's ping capabilities inside a batch file is one great way to keep track of network connectivity. While Nmap has a Lua scripting engine included, writing a Lua script for continuous ping would be time-consuming and difficult. Whether you use Nmap in a business setting or at home, automation through batch files in Windows can make whatever you're doing easier.

Download and install Nmap to the default location. This may require administrator privileges on a Windows operating system.

Create a new text file with Notepad. You can do this by right-clicking on your desktop and selecting "New" and then "Text document," or by simply opening Notepad. This will be your batch file.

Copy the following into your new text document, replacing [your target] with the address to ping. (Keep the quotes around the program and install directory the way they are):

:TOP

"C:\Program Files\Nmap\nmap.exe" -sn [your target]

GOTO TOP

Save the document as whatever name you like, with the BAT file extension. This will let Windows know to run it like a program, rather than opening it in Notepad. On your desktop, it should have something like the name "nmap.bat" and have a different icon from a text file.

Double-click the batch file. It should scroll text continuously, indicating that the ping is running.

Tip

To get results that are easier to read, add "-on log.txt --append-output" (without quotes) before your target location. This will add all the scrolling text to a file called log.txt.

Warning

Continuous pinging can be considered malicious. Make sure you own any computer you plan on continuously pinging.

Things You'll Need

  • Nmap software
  • Notepad
  • Windows PC
Cite this Article A tool to create a citation to reference this article Cite this Article

About the Author

Brad Malloy is a professional writer whose work has appeared in his college newspaper, "Pipe Dream," and on a self-published blog reviewing computer components. Prior to writing, Malloy worked in information technology for two years and brings computer-networking, programming and gaming expertise to his online articles. He holds a Bachelor of Arts in English.