批处理_日期结合定时任务自动备份


@echo off
:: 取当前年月日
set year=%date:~0,4%
set month=%date:~5,2%
set day=%date:~8,2%
:: 取from目录
set from1="C:\Linyuan\test\from1"
set from2="C:\Linyuan\test\from2"
:: 在to目录下创建日期文件夹
set to1=C:\Linyuan\test\to1\%year%%month%%day%
set to2=C:\Linyuan\test\to2\%year%%month%%day%
mkdir %to1%
mkdir %to2%
:: 备份文件
xcopy /e /y /h %from1% %to1%
xcopy /e /y /h %from2% %to2%

posted @ 2019-10-31 09:01  林远  阅读(463)  评论(0)    收藏  举报