Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Batch File to Run Program and Output Time Finished

Posted on 2003-03-13
Medium Priority
Last Modified: 2010-04-17
I am looking to find a way to write a batch file to run an executable.  This exectuable will run for several hours converting a SQL database from one version to another.  We expect that this process will take approximately 5 hours.  I would like to be able to create the batch file in such a way that once the program has completed its task, it will create a file with the date and time that the program stopped.  In reality, all I need (minimally) is for after the program is completed, just for the batch program to create a file.  This will have a date and time created stamp on the file.  The operating system will be on windows 2000 server.

(As a side note, I am not stuck to the idea of batch files only,  if someone can come up with a better way, that would be acceptable as well)

I am a novice at batch files.  The syntax for such a file would be greatly appreciated.  Thanks
Question by:pattersonr

Expert Comment

ID: 8130032
Hey Pattersonr,
   Using Batch file is itself a good idea, because it will not execute next statement in the batch file, until it is done with the current statement.  For example : For simplicity your batch file consists of following statements...

md abc
copy e:\*.* abc
deltree /y abc

In this case even deltree statement takes less time and copy statement takes more time comparitively, it will wait for the completion of copy statement.

This way you will be able to do your job without using timer/indicators....

Regards Dutt.

Accepted Solution

errorx666 earned 200 total points
ID: 8131767
@echo off
echo Executing program...
REM Run the program
echo Execution complete.
REM Create the file
REM > will send the output of echo directly into myfile.log
echo The operation has completed successfully. > myfile.log

Author Comment

ID: 8131864
Thanks..That was exactly what I was looking for. I needed just enough syntax to help me fill in the values.  Perfectly answered.

Thanks again

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

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

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Simple Linear Regression
Loops Section Overview

578 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