Can this be done with standard means?
|
The Windows Server 2003 Resource Kit contains timeit.exe that displays detailed execution stats. Here is an example, timing the command "timeit -?":
You can get TimeIt in the Windows 2003 Resource Kit. Download it here. |
|||||||||||||||
|
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 |
|||||||||
|
Hehe, the most simple solution might be this:
This works on every Windows out of the box. |
|||||||||||||||
|
If you want
Try copying the following script into a new batch file (e.g. timecmd.bat): EDIT: added improvements suggested by @ScottStafford
Usage If you put timecmd.bat in a directory in your path, you can call it from anywhere like this:
e.g.
If you want to do output redirection, you can quote the command like this:
This should handle commands that run from before- to after-midnight, but the output will be wrong if your command runs for 24 hours or more. |
|||||||||||||||||
|
If you have a command window open and call the commands manually, you can display a timestamp on each prompt, e.g.
gives you something like
if you have a small batch script that executes your commands, have an empty line before each command, e.g.
you can calculate the execution time for each command by the time info in the prompt. The best would probably be to pipe the output to a textfile for further analysis:
|
|||
|
The one-liner I use in Win2008 R2 is:
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. |
||||
|
Since others are recommending installing things like freeware and PowerShell, you could also install Cygwin, which would give you access to many basic Unix commands like time:
Not sure how much overhead Cygwin adds. |
|||||
|
Not quite as elegant as some of the functionality in unix, but create a cmd file which looks like:
That will display the start and stop times like so:
|
|||||||||||||
|
I use a freeware called "GS Timer". Just make a batch file like this:
If you need a set of times, just pipe the output of timer /s into a .txt file. You can get it here: GS Timer at SoftPedia |
|||||||||||||
|
As long as it doesn't last longer than 24hours...
|
|||
|
I'm using Win XP and for some reason timeit.exe does not work for me. I found another alternative - PTIME. This works very good. |
||||
|
There's also TimeMem (March 2012):
|
|||
|
@echo off date /t time /t YourApp.exe date /t time /t
|
|||||
|
In case anyone else has come here looking for an answer to this question, there's a Windows API function called |
|||
|
Process Explorer will show kernel time, user time, and wall time (and lots of other stuff) as long as you click on the process before it exits. Not a command-line tool, but immensely useful anyway. |
|||
|
|
||||
|
Related Tags: windows time cmd batch timer command-line batch-file Semi-Related Links that may be of interest: |
|||
|