Archive: Copying with timestamp in filename


Copying with timestamp in filename
I trying to do copy a file to a "backup" directory and place a timestamp on the filename.

I tried this, which works fine from cmd.exe, but doesn't work like this:
ExecWait 'copy "$INSTDIR\Data.mdb" "$INSTDIR\Backup\Data%date:~10,4%%date:~4,2%%date:~7,2%%time:~0,2%%time:~3,2%%time:~6,2%%time:~9,2%.mdb"'

Nor does this:
ExecShell "copy" '"$INSTDIR\Data.mdb" "$INSTDIR\Backup\Data%date:~10,4%%date:~4,2%%date:~7,2%%time:~0,2%%time:~3,2%%time:~6,2%%time:~9,2%.mdb"'

Now does this:
CopyFiles "$INSTDIR\Data.mdb" "$INSTDIR\Backup\Data%date:~10,4%%date:~4,2%%date:~7,2%%time:~0,2%%time:~3,2%%time:~6,2%%time:~9,2%.mdb"

I could copy cmd.exe to the destination computer, but I'm afraid the same cmd.exe may not work on other non-XP OS's.

Edit: FYI, The backup directory does exist


Resolved: I ended up just using the GetTime function and CopyFiles command instead.