1 @echo off 2 rem 先要检查 echo %date:~0,10% 的输出内容,不能含斜划线。 3 rem 7za.exe 7za.dll 7zxa.dll 的 %path% 中已存在。 4 5 :publicVariable 6 set backupDir=C:\backups 7 set dumpDir=C:\Downloads 8 9 :bakMySQL-abc 10 set dbName=abc 11 set dbUser=abc_user 12 set dbPassword=3BwcmyCXagT2 13 del /q /f %backupDir%\db_%dbName%_*.7z 14 mysqldump -hlocalhost -P3306 -u%dbUser% -p%dbPassword% --events --routines --triggers --databases %dbName% > %dumpDir%\db_%dbName%_%date:~0,10%.sql 15 7za.exe a -t7z %backupDir%\db_%dbName%_%date:~0,10%.7z %dumpDir%\db_%dbName%_%date:~0,10%.sql 16 del /q /f %dumpDir%\db_%dbName%_%date:~0,10%.sql 17 18 :bakFiles-abc 19 set sourceName=abc 20 set sourceDir=C:\abc 21 del /q /f %backupDir%\file_%sourceName%_*.7z 22 7za.exe a -t7z %backupDir%\file_%sourceName%_%date:~0,10%.7z %sourceDir% 23 24 exit
Q 说:
欢迎转载,但请注明内容的来源或URL;
“[转]”篇章,必须保留原始来源且勿添加本blog指向。
欢迎转载,但请注明内容的来源或URL;
“[转]”篇章,必须保留原始来源且勿添加本blog指向。