PowerShell - Measure-Command Cmdlet



Cmdlet

Measure-Command Cmdlet 用於測量指令碼或命令所用的時間。

在這些示例中,我們將看到 Measure-Command Cmdlet 的實際應用。

示例

在此示例中,我們將展示如何測量 Get-EventLog 命令在 PowerShell 事件日誌中記錄事件所用的時間。

Measure-Command { Get-EventLog "Windows PowerShell" }

輸出

Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 0
Milliseconds      : 50
Ticks             : 506776
TotalDays         : 5.86546296296296E-07
TotalHours        : 1.40771111111111E-05
TotalMinutes      : 0.000844626666666667
TotalSeconds      : 0.0506776
TotalMilliseconds : 50.6776 
powershell_advanced_cmdlets.htm
廣告
© . All rights reserved.