Batch - How To Ping A Range Of IP Addresses Using Windows BATCH FOR /L Command

Опубликовано: 20 Январь 2025
на канале: Computertechlighthouse
1,992
9

Hello Windows Administrator or Windows Network Administrator. This video is about how to ping range of IP addresses using Windows cmd FOR /L command.

You know we can do this using command FOR /L. FOR /L is other variant of FOR command.

In this video we will do:
1. Ping all hosts on other subnet that your current subnet. Mine subnet for instance 192.168.42.0/24. So in this case we will ping 192.168.1.0/24 subnet: FOR /L %i IN RANGE (1,1,254) DO PING 192.168.1.%i -n 1

2. Ping all hosts in your current subnet:
FOR /L %i IN (1,1,254) DO PING 192.168.42.%i -n 1

3. PING a bunch of hosts or a range of IP addresses on the internet.
FOR /L %i IN (1,1,10)

4. Ping all host on a subnet and save the output to a file
FOR /L %i IN (1,1,10) DO PING 192.168.1.%i -n 1 "redirection operator"

5. Ping all host on a subnet and save the output to a file in shorter form of output using FIND command.
FOR /L %i IN (1,1,254) DO PING 192.168.1.%i -n 1 | FIND /i "Reply" "redirection operator" testpinghost_192.168.1.%i.txt

P.S.: You can erase all files that generated by example 4 and 5 using this command: DEL

Thanks for watching and don't forget to subscribe.