How do I measure execution time of a command on the Windows command line?

后端 未结 30 3265
南笙
南笙 2020-11-22 09:44

Is there a built-in way to measure execution time of a command on the Windows command line?

30条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-22 10:14

    Alternatively, Windows PowerShell has a built in command that is similar to Bash's "time" command. It is called "Measure-Command." You'll have to ensure that PowerShell is installed on the machine that runs it.

    Example Input:

    Measure-Command {echo hi}
    

    Example Output:

    Days              : 0
    Hours             : 0
    Minutes           : 0
    Seconds           : 0
    Milliseconds      : 0
    Ticks             : 1318
    TotalDays         : 1.52546296296296E-09
    TotalHours        : 3.66111111111111E-08
    TotalMinutes      : 2.19666666666667E-06
    TotalSeconds      : 0.0001318
    TotalMilliseconds : 0.1318
    

提交回复
热议问题