Using dt in batch files
Problem Description :
adding the date to datafile name in a batch file
Resolution :
To add the date to the datafile name in a batch file
Add bellow for loop to the batch file
for /f %%i in ('date2 +"%%Y%%m%%d"') do set dt=%%i
and add %dt% to the filename
I’ve always hated how doing a “date /t” and “time /t” makes 2 lines for date/time and no way to enter other informational text. I found a set of Unix type windows commands that has a new date output command and saved it to n:\csd\utils. If you do the “call \\casper\c\sp” command in batch file you should have access to run date2.exe. It has lots of formatting options but an quick & easy one I just did is:
date2.exe +"Running Script - %%D %%T" >> ScanDuplicateDelete.log
which gives the output
Running Script - 07/19/12 09:10:00
It could probably be used to format a file name to save the date/time of archives also.
Revision Date : 8/28/2012