Friday, 4 June 2010

adding dates to a filename in a bat script

In case others out there need something so prehistoric as making a bat script which adds a date to a filename for ex when creating a back up with 7-zip.

The following worked for me:

call "c:\Program Files\7-Zip\7z.exe" a -tzip %date:~6,4%-%date:~3,2%-%date:~0,2%.%time:~0,2%-%time:~3, *.dll

will zip files into an archive called:

Hope it will save you some frustration!

No comments: