Wednesday, September 24, 2014

Display the start and finish time of a batch file

Not an overly difficult task, but something useful I now use when a batch file is required in Windows land.

To Display the start time of a script

@ECHO OFF
setlocal enableDelayedExpansion

echo Started: !DATE! - !TIME!

The enableDelayedExpansion line stops the script form expanding the date and time variables at compile time, and instead executes them real time. So you can add the above to the start of the script and the following at the end to display the date and time before script execution completes:

echo Finished: !DATE! - !TIME!

No comments:

Post a Comment