Using A Batch File to Append The Date to a Filename
Posted on 2004-10-29
I am using Windows 2000 and need to create a batch file to append the date to a filename. The filename is "order.txt" so for example I need to make it "order20041029.txt" - the date format being YYYYMMDD.
Through another example on Experts Exchnage I manage to do the following:
ren d:\orders\order.txt order%date:~7,2%%date:~4,2%.csv
This however gives the result "order1029.txt". Can you a) let me know what I need to do to amend my line of code and b) explain what it means? I would like the answer urgently if possible.