Quote: Originally Posted by SpiritKing
I'm trying to write a batch file that when run creates a folder named "Backup" followed by the time it was created, and then copies files to that folder.
When I run
md "C:\Users\MasterControlProgram\Documents\MC Server With Backup\Backups\Backup %DATE%\"
xcopy /e /v /y "C:\Users\MasterControlProgram\Documents\MC Server With Backup\Server\world" "C:\Users\MasterControlProgram\Documents\MC Server With Backup\Backups\Backup %DATE%\"
It creates a folder named the date it was created and places the folders in it. How do I make it so the folder is named the time instead of the date?
Welcome to the windows 7 forums.
This will remove the : and spaces from time and concatenate it together
to give you %timest%
One problem with using the time and date is that the format for time can have
:'s in it and directory or file names don't accept the colon.
by stripping out the : you can make a real file or directory name.
the same goes with the date when it is less than 10 on the day or month.
the date can have / marks in it and/or spaces which requires removal.
this does them both.
Execute it and then echo %datest% and the output will be all numbers showing the numeric date and - then the number time.
Give it a shot