Tag:Batch file for regularly executing tasks with bat

  • Batch file for regularly executing tasks with bat

    Time:2021-10-18

    @echo off set txt1=%date:~0,4% :: current yearset txt2=%date:~5,2% : current monthset txt3=%date:~8,2% : current dayset txt4=%time:~0,2% : current hourset txt5=%time:~3,2% : current minuteset txt6=%time:~6,2% : current secondsset date=%txt1%%txt2%%txt3% set time=%txt4%%txt5%%txt6% echo ————————————————– echo  ————- Performing MySQL database backup————–echo ————————————————– echo … echo … echo   Export databaseif exist %date%.sql del %date%.sql c:\Progr*\mysql\bin\mysqldump –add-drop-table -c -u root -p-h  localhost  dbname >e:\%date%.sql echo … echo … if exist dump%date%.7z del dump%date%.7z echo   Zip file7za.exe a -t7z dump%date%.7z %date%.sql -mx9 echo … echo … echo   Delete temporary filedel %date%.sql echo … echo … echo   Backup complete!pause