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

后端 未结 30 2978
南笙
南笙 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:02

    The one-liner I use in Windows Server 2008 R2 is:

    cmd /v:on /c "echo !TIME! & *mycommand* & echo !TIME!"
    

    So long as mycommand doesn't require quotes (which screws with cmd's quote processing). The /v:on is to allow for the two different TIME values to be evaluated independently rather than once at the execution of the command.

提交回复
热议问题