Batch file to test ip address range
Task
Ping a range of IP addresses and report whether they respond to the ping.
Explanation
Simply copy and paste this code into a notepad file and save with the bat extension (remember to enclose the save as file name in quotes so that it doesnt add a txt extension.
@echo off SET t=0 :start SET /a t=t+1 ping -n 1 -l 1 192.168.1.%t% > nul if %errorlevel%==0 echo Host %t% is UP! >> 192.168.1.%t%-up.txt if %errorlevel%==1 echo Host %t% is DOWN! >> 192.168.1.%t%-down.txt IF %t%==999 Exit Goto start
The only modification required is to change the two ip ranges (192.168.1.) to the appropriate range you want to test, where ever the bat file is run from, it will create a text file for each ip address scanned and will indicate whether a response was returned with either -up or -down as the end part of the text files name.
Thanks