在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