0
Thanks

A few words of thanks would be greatly appreciated.

DOS: create filename based on date?



Issue


I need to be able to automatically generate a DOS .txt filename that is the 'date' of when it is created.

Any ideas? My DOS is rather rusty and have run out of ideas.

Solution


You might try something like this:


set filea=MyBigFile%date:~10%%date:~4,2%%date:~7,2%%time:~0,2%%t ime:~3,2%.sav 
copy MyData.dat %filea% 


Since the date is Thu 07/30/2009 and the time is 14:07:00.00,
For today this would give a file named
MyBigFile200907301407.sav

Note


Thanks to sandbeha for this tip on the forum.
0
Thanks

A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jean-François Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.
This document, titled « DOS: create filename based on date? », is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).

0 Comments