I'm trying to create a zip file from a batch script. I need it to be named like archive_.zip
Unfortunately, this doesn't work on systems with the date formatted like y/m/d because of the slashes:
zip some_options "archive_%DATE%.zip"
The %DATE%
variable expands to something like
Mon 09/28/2009
I have access to the gnuwin32 package, so I could use, say, sed
to replace spaces and slashes by dashes. The problem is, how would I use the output of sed
to create the file name of the zip archive?
In Unix (bash), one can use back-quotes to evaluate-in-place a command and use its output in another command, something like:
zip [...] archive_`echo %DATE% | sed -e s/.../.../`.zip
Is there anything similar available in Windows?
Or maybe there's a way to set a variable to the returned value of sed
and use that to construct the file name?