KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am compressing files using WinZip on the command line. Since we archive on a daily basis, I am trying to add date and time to these files so that a new one is auto generated every time. I use the following to generate a file name. Copy paste it to your command line and you should see a filename with a Date and Time component. echo Archive_%date:~-4,4%%date:~-10,2%%date:~-7,2%_%time:~0,2%%time:~3,2%%time:~6,2%.zip Output Archive_20111011_ 93609.zip However, my issue is AM vs PM . The AM time stamp gives me time 9 (with a leading blank space) vs. 10 naturally taking up the two spaces. I guess my issue will extend to the first nine days, first 9 months, etc. as well. How do I fix this so that leading zeroes are included instead of leading blank spaces so I get Archive_20111011_093609.zip ?
Tags (comma-separated)
Save Edits
Cancel