Windows 获取命令耗时
Measure-Command
测量运行脚本块和 cmdlet 所需的时间。
语法
Measure-Command
[-InputObject <PSObject>]
[-Expression] <ScriptBlock>
[<CommonParameters>]
说明
Measure-Command该 cmdlet 在内部运行脚本块或 cmdlet,对操作的执行进行超时,并返回执行时间。
示例
Measure-Command { Get-EventLog "windows powershell" }
# 输出
Days : 0
Hours : 0
Minutes : 0
Seconds : 0
Milliseconds : 276
Ticks : 2760251
TotalDays : 3.1947349537037E-06
TotalHours : 7.66736388888889E-05
TotalMinutes : 0.00460041833333333
TotalSeconds : 0.2760251
TotalMilliseconds : 276.0251