Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學

使用批次檔快速掃描區域網路未使用的 IP 位址

編輯:Windows Vista 教學

網管或一般用戶常需在指定網段(如 192.168.1.1~100)找出未被佔用的 IP 位址。直接用 for 迴圈 ping 會輸出大量資訊難以閱讀。建立批次檔僅記錄超時(未使用)的 IP 並輸出至文字檔,大幅提升效率。

批次檔內容(儲存為 .bat 或 .cmd)

@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.1.%%f | Find "Request timed out." && echo 192.168.1.%%f Timed Out >> IPList.txt && echo off
cls
Echo Finished!
@Echo on
Notepad.exe IPList.txt

使用說明

  • 雙擊執行批次檔,自動掃描 192.168.1.1 至 192.168.1.100。
  • 僅將回應「Request timed out.」的 IP 記錄至 IPList.txt 並以記事本開啟。
  • 適用於 Windows Vista、Windows 7、XP 等所有支援批次處理的 Windows 系統。
  • 可依需求修改 IP 範圍(調整 For /L %%f in (起始,步進,結束) 參數)。

此法簡單實用,避免在命令視窗翻閱海量輸出。

Copyright © Windows教程網 All Rights Reserved