|
Answer» Ran into a subdirectory issue with the \ in the %date% when executing
MD "%date%_backup"
Is there a way to substitute the \ with - or _ to be supported as a continuos DIRECTORY name instead of it chopping into subdirectories for 26th day and 2009 year
C:\test123\Mon 01\26\2009_backup
Probably simple, but I'm stumped.
ThanksUse the SET string=%string:a=b% replacement method (replace all 'a's with 'b's)
or set string=%string:a=% (replace all 'a's with nothing, i.e. delete all the 'a's)
US %date% format is
Day mm/dd/yyyy e.g. Tue 01/27/2009 I think?
So
set Mydate=%date:/=-% set Mydate=%Mydate: =-%
MAKES %Mydate% equal to
Tue-01-27-2009
proof
Code: [Select]Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp.
C:\>set mydate=Tue 27/1/2009
C:\>set Mydate=%Mydate:/=-%
C:\>set Mydate=%Mydate: =-%
C:\>echo %Mydate% Tue-27-1-2009
Hey DIAS de verano ... Thanks for that solution...
|