Link to home
Start Free TrialLog in
Avatar of garykunes
garykunesFlag for United States of America

asked on

How can I tell how long it took a batch file to run

I am running an old-fashioned batch file via Task Scheduler for one particular backup.  My question is, is there a command switch or 3rd party utility that will tell me how long it took for the command to complete?

In other words, I can tell when the command started.  I want to be able to tell when it finished also.

Any and all help is very much appreciated.

Thanks!
Avatar of BrandonGalderisi
BrandonGalderisi
Flag of United States of America image

have it write to a time stamped logfile.
Avatar of theProfessa
I would use a Windows Resource called Timethis.exe

If your batchfile is in C:\TEST\batch.bat you can do the following.

1.  Copy timethis.exe to C:\TEST
2.  Open command prompt window and type in cd c:\test
3.  Type "timethis.exe batch.bat" without the quotes

Hopefully this helps!
Look in the Scheduled Tasks log.  By default this is located at %systemroot%\SchedLgU.Txt.  You can also get to it by going to Advanced|View Log from the Scheduled Tasks window.

It should list start and finish times for all tasks.
I didn't see the Task Scheduler portion of your question.  Alternatively you can incorporate timethis.exe by creating a batch file that runs the batch file.  Then schedule that to run.

Just a thought.
ASKER CERTIFIED SOLUTION
Avatar of nauthencharge
nauthencharge
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of garykunes

ASKER

Great solution.  Thanks so much for your help.  This is EXACTLY what I needed.