//Using the 192.168.1. subnet as an exampleipconfig /all >ipconfig.txt
find "Default Gateway" ipconfig.txt >IP.txt
for /f "skip=2 tokens=13" %%a in (ip.txt) do echo %%a >ip.txt //Shows as 192.168.1.1 (gateway)
setlocal enabledelayedexpansion
for /f "tokens=*" %%d in (ip.TXT) do (
set str=%%d
echo !str:~0,-4! >ip.TXT) //Shows as 192.168.1. with a space after it
for /f "delims=" %%c in (ip.txt) do set a=%%c
if " " == "%a:~-1,1%" (set "a=%a:~0,-1%" ) //Remove the space through processing
set i=%a%
for /l %%p in (1,1,254) do @echo ping %i%%%p -n 1 >%%p.bat //Input the subnet variable
for /l %%p in (1,1,254) do @echo exit >>%%p.bat //Add the ending command
for /l %%p in (1,1,254) do start %%p.bat //254-thread command splicing
ping 1.1.1.1 -n 2 //Used for delay (I could only think of a simple one)
arp -a >arp.txt //Shows online IPs and MACs on the subnet. In current XP, if you don't ping them first, arp -a is useless. Everyone can try it, it will only show the gateway info.
del ipconfig.txt ip.txt
for /l %%p in (1,1,254) do del %%p.bat //Delete temporary files

[ Last edited by zw750516 on 2007-8-4 at 09:08 PM ]
