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

XP 批次檔快速掃描 DHCP 閒置 IP:單次建立、反覆使用的 IP 追蹤工具

編輯:XP 常見問題解答

網管排查 DHCP 衝突需找出網段內未使用 IP。單純 ping 迴圈輸出太多資訊,批次檔過濾僅顯示逾時 (未使用) IP 並記錄至檔案。

建立 IPTracker.bat

  1. 記事本貼上以下內容 (單行 For 迴圈,&& 連接):
    @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
  2. 存為 IPTracker.bat (編碼 ANSI)。
  3. 雙擊執行,自動掃描 192.168.1.1-100,將逾時 IP 寫入 IPList.txt 並用記事本開啟。

關鍵點

  • 需依實際網段修改 IP 範圍 (第三節) 與掃描範圍 (1,1,100)。
  • Ping -n 2 僅送 2 封封包加速。
  • Find "Request timed out." 過濾無回應 (未使用) IP。
  • 僅適用 Windows XP Professional (Home 版無 findstr/完整 for 支援)。

一次製作,長期使用,大幅提升 DHCP 故障排查效率。

Copyright © Windows教程網 All Rights Reserved