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.
- Skill level:
Other People Are Reading
Things you need
- Nmap software
- Windows PC
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):
"C:\Program Files\Nmap\nmap.exe" -sn [your target]
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.
Tips and warnings
- 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.
- Continuous pinging can be considered malicious. Make sure you own any computer you plan on continuously pinging.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for