Solved

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

Posted on 2008-10-01
7
262 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!
0
Comment
Question by:garykunes
7 Comments
 
LVL 39

Expert Comment

by:BrandonGalderisi
ID: 22618319
have it write to a time stamped logfile.
0
 
LVL 11

Expert Comment

by:theProfessa
ID: 22618458
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!
0
 
LVL 38

Expert Comment

by:Shift-3
ID: 22618464
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.
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 11

Expert Comment

by:theProfessa
ID: 22618465
0
 
LVL 11

Expert Comment

by:theProfessa
ID: 22618491
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.
0
 

Accepted Solution

by:
nauthencharge earned 250 total points
ID: 22633936
I just had to do something like this, so I had the script create a log file, placing a timestamp before and after the command.  I have placed code below.

echo ******************** >> log.txt

echo Copy Started on %DATE% %TIME% >> log.txt

echo ******************** >> log.txt

REM PLACE YOUR CODE HERE

echo ******************** >> log.txt

echo Copy Finished on %DATE% %TIME% >> log.txt

echo ******************** >> log.txt

Open in new window

0
 

Author Closing Comment

by:garykunes
ID: 31502135
Great solution.  Thanks so much for your help.  This is EXACTLY what I needed.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
I have published numerous articles here at Experts Exchange that present programs/scripts written in a language called AutoHotkey. Each of those articles has a brief paragraph describing where to download the product and how to install it. I have al…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now