寬帶普及後,撥號上網雖少見,但仍有用戶需計費或統計上網時長。XP 內建「事件檢視器」記錄每次 RemoteAccess 服務的連線/斷線事件,即使已斷線也能追溯完整時長。
Event ID 20176 為連線成功,20177 為斷線。每兩筆(連線→斷線)即為一次上網時段。@echo off
set LOG=%temp%\dialup.log
dumpel -s %computername% -l System -e 20176 -e 20177 -m RemoteAccess -o %LOG%
rem 後續可用 findstr / find / for 迴圈解析時間差,輸出 CSV
(需 Windows 2000 Resource Kit 的 dumpel.exe 或 PowerShell Get-WinEvent)
RasClient 或 WANMiniport,需依實際日誌調整篩選條件。善用事件檢視器,無需額外計費軟體即可精確掌握上網時長。