1.

Solve : help with iplist batch file?

Answer»

I want a batch file that will make a list starting at 0.0.0.0 and ending at 255.255.255.255 but when one # hits 255 it needs to ADD 1 to the # on its left? this WOULD make a list of all posible ip address is this corect or would it leave some out?Quote

this would make a list of all posible ip address is this corect or would it leave some out?

A correctly written batch file would indeed cover all 4,294,967,296 of them.

Code: [Select]@ECHO off
set octet1=0
set octet2=0
set octet3=0
set octet4=0

:loop
set /a octet4=%octet4%+1
if %octet4% GTR 255 (
set /a octet3=%octet3%+1
set octet4=0
)
if %octet3% GTR 255 (
set /a octet2=%octet2%+1
set octet3=0
)
if %octet2% GTR 255 (
set /a octet1=%octet1%+1
set octet2=0
)
echo %octet1%.%octet2%.%octet3%.%octet4%
if %octet1%.%octet2%.%octet3%.%octet4%==255.255.255.255 goto :eof
goto loop

Why anybody would need such a thing is beyond me, but hey what do I know :-?
Hey sidewinder, I've always wanted to know, what do "(" do in a batch file???that was like the solution i FOUND, i was just wondering if it would get all of them.Or SIMPLY:

[edit]for /L %%a in (0,1,255) do (
for /L %%b in (0,1,255) do (
for /L %%c in (0,1,255) do (
for /L %%d in (0,1,255) do (
echo.%%a.%%b.%%c.%%d
))))[/edit]

dakota,
If you plan to ping all IP addresses and let's say a single ping takes 1 second and you start your batch script today ([timestamp=1155103143]) then the script will finish on 9/15/2142 which is a Saturday
HAHAHAHAHAHAHAHAHAH
Yes, I think he is/was planning to ping them!!


Discussion

No Comment Found