备份数据到指定目录下,目标目录名会自动添加当天的日期。
@echo off
set ymd=%date:~0,4%%date:~5,2%%date:~8,2%
set Views_bak=Views%ymd%
if not exist "D:\Backup"\%Views_bak% (
mkdir "D:\Backup"\%Views_bak%
xcopy "D:\data"* "D:\Backup"\%Views_bak%\ /E /C /Y
)
else
(
xcopy "D:\data"* "D:\Backup"\%Views_bak%\ /E /C /Y
)
exit
2、创建Windows计划任务