Skip to main content

Ping group on Windows with FOR command

Source: https://www.foodbev.com/news/food-and-drink-firms-join-loop-waste-free-shopping-platform/

Notes from daily work situation.

One of my colleagues asked me to find out which IP address that his home router dynamically assign to his brand new TOTOLINK N9 Ceiling Mount Access Point without accessing to the home router.

Look at TCP/IP settings, I know the IP address range that the home router assign to client is 192.168.1.2 - 192.168.1.254.


I also know MAC address of the new TOTOLINK N9 Access Point.

So, the idea is using his laptop to ping IP addresses from 192.168.1.2 - 192.168.1.254, then using arp -a command to find out MAC Address of TOTOLINK N9 Access Point.

So, I use FOR command to ping a group of IP Addresses from 192.168.1.1 to 192.168.1.254

FOR /L %variable IN (start,step,end) DO command [command-parameters]

    The set is a sequence of numbers from start to end, by step amount.
    So (1,1,5) would generate the sequence 1 2 3 4 5 and (5,-1,1) would generate the sequence (5 4 3 2 1)


for /l %i in (1,1,254) do @ping 192.168.1.%i -n 1 -w 100 | find "Reply"

-n count       Number of echo requests to send
-w timeout     Timeout in milliseconds to wait for each reply


Ping and Arp command to find IP Address and MAC of TOTOLINK N9
Ping and Arp command to find IP Address and MAC of TOTOLINK N9

Popular posts from this blog

Data Recovery Softwares

Follow 3-2-1 backup rule so you do not need these data recovery softwares.

Delete files older than 365 days

I must delete IIS *.log files in  older than 365 days. D:\Logs | -W3SVC1 -W3SVC2 -... -W3SVC33 daily-delete-logfiles-older-than-365-days.cmd :: Daily delete log files older than 365 days :: Created on: 20161120 :: Created by: :: Last modified on: :: Last modified by: :: History: SET DIRLOG=E:\_scripts\Logs\ :: Echo @path to test first :: FORFILES /P D:\Logs /S /M *.log /D -365 /C "cmd /c echo @path @fdate" :: Delete files ECHO "Begin" >> %dirlog%daily-delete-logfiles.log DATE /T >> %dirlog%daily-delete-logfiles.log TIME /T >> %dirlog%daily-delete-logfiles.log FORFILES /P D:\Logs /S /M *.log /D -365 /C "cmd /c del @path" >> %dirlog%daily-delete-logfiles.log ECHO "Finished" >> %dirlog%daily-delete-logfiles.log DATE /T >> %dirlog%daily-delete-logfiles.log TIME /T >> %dirlog%daily-delete-logfiles.log :: END of script /P : Path to folder /S: recurse into subdirectories /M *.l...