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

Windows XP 批次掃描偵測區域網路閒置 IP 位址技巧

編輯:Windows XP 系統介紹

在處理 Windows XP 的 DHCP 故障、網路規劃或安全稽核時,常需快速找出特定 IP 範圍內未被使用的位址。單純使用 ping 逐一測試不僅耗時,輸出資訊龐大難以分析。本文介紹透過批次檔自動化掃描,並僅記錄無回應的 IP 位址至文字檔,大幅提升效率。

核心指令原理

利用 For /L 迴圈搭配 ping -n 2(發送 2 個封包),遍歷指定範圍。範例掃描 192.168.1.1 至 192.168.1.100:

For /L %f in (1,1,100) Do Ping.exe -n 2 192.168.1.%f

批次檔完整實作(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

關鍵說明

  • 整個 For...In...Do 指令需寫在同一行,以 && 串接多個子指令
  • Find "Request timed out." 過濾無回應的 IP
  • 執行結果自動輸出 IPList.txt 並以記事本開啟
  • 須將範例 IP 網段(192.168.1.x)替換為實際環境網段

適用範圍與注意事項

  • 主要適用 Windows XP 環境
  • Windows 7/8/10 核心邏輯相同,但指令語法細節可能略有差異,可參考調整
  • 若目標主機啟用防火牆封鎖 ICMP,會被誤判為「未使用」,需輔以 ARP 掃描或其他方式驗證

掌握此技巧,即可在 XP 區域網路環境快速盤點 IP 使用狀態,協助網路故障排除與 IP 規劃管理。

Copyright © Windows教程網 All Rights Reserved