Solved

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

Posted on 2008-10-01
7
263 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Can I legally transfer my OEM version of Windows to another PC?  (AKA - Can I put a new systemboard in my OEM PC?) Few of us are both IT and legal experts but we all have our own views of Microsoft's licensing rules and how they apply.  There are…
You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

919 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

19 Experts available now in Live!

Get 1:1 Help Now