1

I want to include the number of the previous week at the end of the name of the file when copying a file to a different folder with a scrip in a batch file.

I'm trying the following>

echo f | xcopy /f /y "\\Mypath\MyFile.xlsb" "\\Mypath\MyFile WK"%WEEK%".xlsb" 

But the result I'm getting is \Mypath\MyFile WK.xlsb

Desire result is \Mypath\MyFile WK12.xlsb

Thank you so much

zb226
  • 9,586
  • 6
  • 49
  • 79
Samuel
  • 109
  • 2
  • 12

1 Answers1

0

Maybe not the best answer but for those who need to get the week, this is the way I was able to finally get the week and accomplish what I needed.

   WIN32_LOCALTIME GET /FORMAT:LIST') DO @(SET %%a>NUL)
   SET /A a=(14-%Month%)/12,y=%Year%-a,IsoWeek=(%Day%+(153*(%Month%+12*a-3)+2)/5+365*y+y/4)/7-(365*%Year%+(%Year%+3)/4)/7+9

   echo f | xcopy /f /y "\\Mypath\MyFile.xlsb" "\\Mypath\MyFile WK"%IsoWeek%".xlsb" 
Samuel
  • 109
  • 2
  • 12