需快速掃描區域網路 (如 192.168.0.x) 哪些 IP 存活?XP 下用批次檔循環 Ping 並記錄逾時 IP,無需第三方掃描器。
@Echo off
date /t > IPList.txt
time /t >> IPList.txt
echo =========== >> IPList.txt
For /L %%f in (1,1,100) Do (
Ping.exe -n 2 192.168.0.%%f | Find "Request timed out." >nul
If ErrorLevel 1 (
echo 192.168.0.%%f Timed Out >> IPList.txt
)
)
cls
Echo Finished!
Notepad.exe IPList.txt
192.168.0 為你的網段前綴。(1,1,100) 對應最後一段 IP 範圍。-n 2 發送 2 個封包,平衡速度與準確度。IPList.txt 顯示逾時 IP 清單。限制:目標電腦啟用防火牆封鎖 ICMP 時會誤判為離線;僅適用 IPv4、XP/2003 環境 (新版 Windows PowerShell `Test-Connection` 更強大)。