5

Is there a built in command in windows similar to the time command?

I am looking for a way to measure how long it takes certain taks to run, and would like to use something more accurate than a stopwatch.

2 Answers 2

5

There is a program called timeit.exe included as part of the Windows 2003 Resource Kit, which is a free download (and works fine on Win7, FWIW).

There are lots of complicated options for dealing with timing databases and such, but the "-s" option skips all that and just reports the time at the end:

timeit -s command

If you need to stick strictly to the built-in commands, I think you'd have to create a batch file with the following and compute the time-difference yourself (which is possible to do in the batch file itself, but overly complicated):

echo %DATE% %TIME%
command
echo %DATE% %TIME%
0

You can use the Get-Date cmdlet in Powershell, but if you're after millisecond precision then this cmdlet isn't gonna do any good, since it returns a date and current time down to seconds.

1
  • Out of curiosity, how would you use that to measure program start time? Still trying to learn PS atm...
    – user48869
    Sep 24, 2010 at 18:01

You must log in to answer this question.