Once I was looking for a batch script(shell script), that can be used to ping any range of IPs on LAN or internet, but ultimately I thought why not write a script by myself. So here it goes.
An incremental ping script which will ping a specific range or all the IPs available. This is for IP4 only. For IP6 I will post later once done.
Create a batch file(same file attached Attachment 8376) with the following code in it and run it.
@ECHO OFF
:STR
::In the following A,B,C,D are IP values as Ai.Bi.Ci.Di or Ar.Br.Cr.Dr
::Range start
SET Ai=1
SET Bi=9
SET Ci=4
SET Di=5
::Range end
SET Ar=110
SET Br=197
SET Cr=40
SET Dr=155
:SETIP
::IP values concatenated to give an IP address
SET IP=%Ai%.%Bi%.%Ci%.%Di%
::Change the value followed by "-w" in the following ping line to change default ping wait time in case of late or no response
::Change the value followed by "-n" in the following ping line to change default number of ping requests to be sent for one IP
PING -a -n 1 -w 500 %IP%
IF ERRORLEVEL 1 (echo %IP% Unavailable or not responding) ELSE (echo %IP% Available)
SET /A Di=%Di%+1
IF %Di% LSS %Dr% (GOTO SETIP) ELSE (GOTO Ci)
:Ci
SET Di=0
SET /A Ci=%Ci%+1
IF %Ci% LSS %Cr% (GOTO SETIP) ELSE (GOTO Bi)
:Bi
SET Ci=0
SET Di=0
SET /A Bi=%Bi%+0
IF %Bi% LSS %Br% (GOTO SETIP) ELSE (GOTO Ai)
:Ai
SET Bi=0
SET Ci=0
SET Di=0
SET /A Ai=%Ai%+0
IF %Ai% LSS %Ar% (GOTO SETIP) ELSE (GOTO STR)
======================
Results are sometimes unpredictable but least expected to happen.
If you fail to run the script directly by double-click, then drag the file to command line and hit enter, it should work.
Everybody is welcome to modify and suggest anything new but do notify about the improvement in this thread.
I don't think the shell script will have any big difference, so try it by yourself.
Waiting for comments as always.