Copy file and rename copied file using MS DOS command

Copy File then rename the copied file with date and time using dos command
C:FileName.bak Z: /C /Y ren Z:FileName.bak FileName.bak%date:~4,2%-%date:~7,2%-%date:~10,4%-%time:~1,1%%time:~3,2%%time:~6,2%

I discovered that when the folder name is with spaces. just put a double qoute.
XCOPY C:FileName.bak Y:”Folder Name””Sub Folder” /C /Y
ren Y:”Folder Name””Sub Folder” Filename.bak FileName.bak%date:~4,2%%date:~7,2%%date:~10,4%-%time:~1,1%%time:~3,2%%time:~6,2%

Comments

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>