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

WinXP 如何追蹤區網未使用 IP 位址?批次檔 Ping 掃描自動記錄

編輯:XP 系統應用技巧

需找出區網(如 192.168.1.x)哪些 IP 未被使用?撰寫批次檔利用 ping 掃描,自動將「Request timed out」的 IP 記錄至文字檔。

批次檔內容(IPTracker.bat)

@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

使用說明

  1. 將上述碼存為 IPTracker.bat(注意 For...Do 命令必須在單一行)。
  2. 將範例 IP 192.168.1. 改為實際區網網段。
  3. 雙擊執行,自動掃描 1~100 號 IP,結果以記事本開啟顯示未使用 IP 清單。
  4. 可重複使用,解決 DHCP 衝突、規劃靜態 IP 分配。

批次檔掃描結果

適用版本:Windows XP Professional(專業版),Home Edition 無 gpedit.msc 但批次檔仍可執行。
Copyright © Windows教程網 All Rights Reserved