另一个方法是设置两个时间快照和结束时间,计算它们的时差。这将告诉你Get-Hotfix执行了多久,得到的输出数据里将包含脚本执行的时间:
复制代码 代码如下:$start = Get-DateGet-HotFix$end = Get-DateWrite-Host -ForegroundColor Red ("Total Runtime: " + ($end - $start).TotalSeconds)
文章出处:http://www.pstips.net/