I'm trying to create a file from a file, actually coping from another source (the commands work good with a fixed name) but i need the filename to contain de date in it, and i cant get this function to work, see code please:
for /f "skip=1 tokens=1-6 delims= " %%a in ('wmic path Win32_LocalTime Get Day^,Hour^,Minute^,Month^,Second^,Year /Format:table') do (
IF NOT "%%~f"=="" (
set /a FormattedDate=10000 * %%f + 100 * %%d + %%a
copy "File.xlsx" "C:\Documents and Settings\%USERNAME%\Desktop\File_%!FormattedDate:~-2,2!%_%!FormattedDate:~-4,2!%_%!FormattedDate:~-6,2!%.xlsx"
I tried without % % too
a simpler approach would be acceptable too