I found the base code for this here already and was using it to move and then rename a file where I knew the file name. However, now I would like to move a file where the file name is a parameter.
When I run this code it renames the folder with the current date and time. How do I get it to rename the variable file name in the folder? I added the pause to try and troubleshoot what was happening.
Echo Off
SET SiteName=%~1
SET FileDate=%~2
SET File=%SiteName%%FileDate%
IF Not EXIST C:\Users\Administrator\Documents\~Withdrawal_Report\%File% GOTO DoNothing
copy C:\Users\Administrator\Documents\~Withdrawal_Report\%File% C:\Users\Administrator\Documents\~Withdrawal_Report_Archive\%File%
ren C:\Users\Administrator\Documents\~Withdrawal_Report_Archive\%File% %SiteName%-%date:~4,2%-%date:~7,2%-%date:~10,4%_@_%time:~0,2%h%time:~3,2%m%time:~6,2%s%.csv
ren C:\Users\Administrator\Documents\~Withdrawal_Report_Archive\%File% %SiteName%-%date:~4,2%-%date:~7,2%-%date:~10,4%_@_%time:~1,1%h%time:~3,2%m%time:~6,2%s%.csv
del C:\Users\Administrator\Documents\~Withdrawal_Report\%File%
pause
:DoNothing
Exit