探测局域网内PING不通的IP
@echo on
set /p=>ip.txt<nul
for /l %%a in (4,1,254) do (
for /f %%i "delims==tokens=1" in ('ping -n 1 192.168.137.%%a^|findstr "Request timed out"')do (
echo %%i 192.168.137.%%a>>ip.txt
)
)
start ip.txt
pause
探测局域网内存活的主机:
@echo on
set/p=>list.txt<nul
for /l %%a in (3,1,254) do (
echo.&echo.
for /f "delims== tokens=2" %%i in ('nbtstat -A 192.168.137.%%a^|find "MAC Address"') do (
echo %%i=======192.168.137.%%a >>list.txt
)
)
pause
start list.txt
也可以用VBS实现,但对WMI按口不熟,只好作罢。