Windows time stamping in batch files

Creating a time-stamp ย in windows can be usful for the automated backups we all SHOULD be doing ๐Ÿ™‚

 

pkzip c:\<source>\*.* c:\<target>\TempZip.zip
ren C:\<target>\TempZip.Zip c:\<target>\TempZip_%date:~-4,4%%date:~-7,2%%date:~-10,2%.zip

 

Or simply to create a directory for copying open files (Lawrence ๐Ÿ™‚ )

set backdir=%date:~-4,4%%date:~-7,2%%date:~-10,2%

mkdir %backdir%

cdย %backdir%

etc..

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.