Solved

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

Posted on 2008-10-01
7
269 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to execute all sub dir 2 41
Run command in each subfolder using batch file 7 69
how to get the largest file size? 33 61
Eliminating an obsolete notification 5 45
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…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
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…

829 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