Solved

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

Posted on 2008-10-01
7
265 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
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

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.

Question has a verified solution.

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

If you have done a reformat of your hard drive and proceeded to do a successful Windows XP installation, you may notice that a choice between two operating systems when you start up the machine. Here is how to get rid of this: Click Start Clic…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

803 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