Hello guys,
Not sure if this is the right section to ask, if not please lead me to the right direction.
I just created a batch file, that would copy a file and the destination file would have an automated date in its file name, I actually wrote this friday and when I test run it, it ran correctly having the friday's date (73010) but when I ran the same batch file again today, its not renaming it correctly, it is now renaming %dte% as 08MAR10... Please help me out figuring out how to fix this.
set day=%date:~-10,2%
set mnth=%date:~-7,2%
set yr=%date:~-2,2%
if %mnth%==01 set mnth=JAN
if %mnth%==02 set mnth=FEB
if %mnth%==03 set mnth=MAR
if %mnth%==04 set mnth=APR
if %mnth%==05 set mnth=MAY
if %mnth%==06 set mnth=JUN
if %mnth%==07 set mnth=JUL
if %mnth%==08 set mnth=AUG
if %mnth%==09 set mnth=SEP
if %mnth%==10 set mnth=OCT
if %mnth%==11 set mnth=NOV
if %mnth%==12 set mnth=DEC
set dte=%day%%mnth%%yr%
echo F | xcopy "\\n-sitnc-fp0\Data\LIVE WORK\2010\DDNC100001_WFB Financial Statement Analysis\test.xls" "\\n-sitnc-fp0\Data\LIVE WORK\2010\DDNC100001_WFB Financial Statement Analysis\TEST\test_%dte%.xls" /Y/Q
Thanks
Not sure if this is the right section to ask, if not please lead me to the right direction.
I just created a batch file, that would copy a file and the destination file would have an automated date in its file name, I actually wrote this friday and when I test run it, it ran correctly having the friday's date (73010) but when I ran the same batch file again today, its not renaming it correctly, it is now renaming %dte% as 08MAR10... Please help me out figuring out how to fix this.
set day=%date:~-10,2%
set mnth=%date:~-7,2%
set yr=%date:~-2,2%
if %mnth%==01 set mnth=JAN
if %mnth%==02 set mnth=FEB
if %mnth%==03 set mnth=MAR
if %mnth%==04 set mnth=APR
if %mnth%==05 set mnth=MAY
if %mnth%==06 set mnth=JUN
if %mnth%==07 set mnth=JUL
if %mnth%==08 set mnth=AUG
if %mnth%==09 set mnth=SEP
if %mnth%==10 set mnth=OCT
if %mnth%==11 set mnth=NOV
if %mnth%==12 set mnth=DEC
set dte=%day%%mnth%%yr%
echo F | xcopy "\\n-sitnc-fp0\Data\LIVE WORK\2010\DDNC100001_WFB Financial Statement Analysis\test.xls" "\\n-sitnc-fp0\Data\LIVE WORK\2010\DDNC100001_WFB Financial Statement Analysis\TEST\test_%dte%.xls" /Y/Q
Thanks