We have a batch job that runs every day and copies a file to a pickup folder. I want to also take a copy of that file and drop it into an archive folder with the filename
yyyy-MM-dd.log
What’s the easiest way to do this in a Windows batch job?
I’m basically looking for an equivalent of this Unix command:
cp source.log `date +%F`.log
But it’s locale dependent. I’m not sure if
%DATE%is localized, or depends on the format specified for the short date in Windows.Here is a locale-independent way to extract the current date from this answer, but it depends on
WMICandFOR /F: