html tool

2020年1月18日星期六

powershell中统计命令使用时间

问题: time 在powershell 如何使用

参考:http://mxii.eu.org/2016/08/05/ways-to-measure-execution-time-in-powershell/


 $startTime=(Get-Date); & tcping -n 100 192.168.100.120 22 ;$Elapsed=(Get-Date)-$startTime; $Elapsed

Pair of [DateTime] objects

Let’s calculate time span as a difference between two moments of time — before and after the command.
> $startTime=(Get-Date); "do stuff"; $Elapsed=(Get-Date)-$startTime; $Elapsed
do stuff


Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 0
Milliseconds      : 0
Ticks             : 9998
TotalDays         : 1,15717592592593E-08
TotalHours        : 2,77722222222222E-07
TotalMinutes      : 1,66633333333333E-05
TotalSeconds      : 0,0009998
TotalMilliseconds : 0,9998

没有评论:

发表评论