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

后端 未结 30 3273
南笙
南笙 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 09:59

    Depending on the version of Windows you're using, just running bash will put you into Bash mode. This will allow you to use a bunch of commands that are not available on PowerShell directly (like the time command). Timing your command is now as easy as executing:

    # The clause  (without the angle brackets) denotes the command you want to run.
    $ time 
    

    Note: You can easily quit from Bash mode and return back into your mainstream shell by running exit while in Bash mode.

    This worked for me perfectly (Windows 10) after trying out other methods (like Measure-Command) which sometimes produce undesired stats. Hope this works for you as well.

提交回复
热议问题