在PowerShell中Measure-Command可用来计算powershell脚本或者命令执行所需要的时间。

(1)计算命令“get-service”执行所需的时间;输入如下命令

Measure-Command -Expression {get-service}

p_w_picpath

 

(2)计算powershell脚本执行所需要的时间;输入如下命令:

Measure-Command -Expression {powershell d:\hw.ps1}

p_w_picpath


参考网址:http://technet.microsoft.com/zh-CN/library/dd347702.aspx