批处理自动备份并生成日志文件

在windows里新建一个计划任务定期去执行以下脚本,脚本会自动执行备份任务,并记录执行结果到日志文件。(执行时间,备份是否成功)

@echo off
@echo ************************************************************
@echo.
@echo   Backing up data files ,Please do not close this Window!
@echo.
@echo ************************************************************
set sourcePath=I:\050_Manufacturing\050_Lean_KPI\A3 Database_201907\DB
set destPath=I:\050_Manufacturing\050_Lean_KPI\A3 Database_201907\Backup
set ETime="%date%-%time%"
If Not Exist "%sourcePath%" (
   echo Couldn't find database file Please check that! 	
   echo Failed:%ETime%>>"%destPath%\log\BackUp.log"
   
) else (
   xcopy "%sourcePath%\*"  "%DestPath%\*" /Y /Q /S
   echo Success:%ETime%>>"%destPath%\log\BackUp.log"
   
)

timeout 20
exit

  

上一篇:Linear Mixed Models


下一篇:Linux(环境篇):系统搭建本地FTP后,无法登录(331 Please specify the password.)问题解决