I have a .cmd file that is copying a .csv file from one server location to another server location. One line of code:
Copy SourceLocation DestinationLoca tion
I have added a line of code to rename the file and if I give it a specific name, it works fine. However, I want the new name to be CTMMDDYY with MMDDYY being yesterdays date. I tried to do something like this, just trying to get todays date to work for me:
set Day = %date:~0,2%
set mth = %date:~3,2%
set yr = %date:~8,2%
then performed a rename like this:
rename CurrentName CT%day%-%mth%-%yr%.csv
But nothing happens. Does anyone have any suggestions on how to make this work? How about going about getting yesterdays date in the cmd script?
Copy SourceLocation DestinationLoca tion
I have added a line of code to rename the file and if I give it a specific name, it works fine. However, I want the new name to be CTMMDDYY with MMDDYY being yesterdays date. I tried to do something like this, just trying to get todays date to work for me:
set Day = %date:~0,2%
set mth = %date:~3,2%
set yr = %date:~8,2%
then performed a rename like this:
rename CurrentName CT%day%-%mth%-%yr%.csv
But nothing happens. Does anyone have any suggestions on how to make this work? How about going about getting yesterdays date in the cmd script?
Comment