We help IT Professionals succeed at work.

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

386 Views
Last Modified: 2010-04-21
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!
Comment
Watch Question

have it write to a time stamped logfile.
CERTIFIED EXPERT

Commented:
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!

Commented:
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.
CERTIFIED EXPERT

Commented:
I forgot the link:
http://www.microsoft.com/Downloads/details.aspx?FamilyID=913795cd-7026-4143-ae85-1f5e096f9be0&displaylang=en
CERTIFIED EXPERT

Commented:
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.
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
garykunesCorporate Director of IT

Author

Commented:
Great solution.  Thanks so much for your help.  This is EXACTLY what I needed.
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.