尝试从远程服务器驱动器复制2个文件..需要替换文件名中的当前日期,月份和年份。
File1 : plugin_229_InventoryService-2017-08-11.log (current day)
File2: plugin_229_InventoryService-2017-08-10.log (previous day)
echo off
cls
::: Begin set date
for /f "tokens=1-4 delims=/-. " %%i in ('date /t') do (call :set_date %%i %%j %%k %%l)
goto :end_set_date
:set_date
if "%1:~0,1%" gtr "9" shift
for /f "skip=1 tokens=2-4 delims=(-)" %%m in ('echo,^|date') do (set %%m=%1&set %%n=%2&set %%o=%3)
goto :eof
:end_set_date
::: End set date
echo day in 'DD' format is %dd%; month in 'MM' format is %mm%; year in 'YYYY' format is %yy%
COPY "\\20.137.181.232\d$\Program Files\folder1\folder2\.folder3\folder4\folder5\channels\plugin_229_InventoryService-%yy%-%mm%-%dd%.log" "D:\Folder\Master_232\"
COPY "\\20.137.181.232\d$\Program Files\folder1\folder2\.folder3\folder4\folder5\channels\plugin_229_InventoryService-%yy%-%mm%-(%dd%-1).log" "D:\TDG\Master_232\"
输出错误:
'DD'格式的日子是11; 'MM'格式的月份是08;年'YYYY' 格式为2 017 系统找不到指定的文件。系统找不到了 指定文件。
有什么建议吗?