Can someone please help me figure out the syntax to add the time to an output file's name? I was able to get the date, but the time isn't working for me. I keep googling it but so far I have come up empty. I have figured out how to add it to the file itself, but I want to be able to see it in the name.
The code below, is just a super simple robocopy
command that I have saved as test.cmd
.
Everything works, everything except adding the time.
Feel free to steal it if you want. Just make sure you Google the switches so that you know what you're doing. That part is easy to find.
My Code
@ECHO OFF
if not exist "C:\Example" mkdir "C:\Example"
ROBOCOPY.EXE C:\Example Source "\\192.168.0.100\Shared Storage" /E /Z /J /NOOFFLOAD /R:2 /W:1 /REG /UNILOG+:"C:\Example Source\%date:~-10,2%-%date:~-7,2%-%date:~-4,4% Time.txt" /MT:4
exit