Nasrul Hazim Bin Mohamad

7z: Zip MySQL Database Dump File via Batch File


First, get 7zip Command Line here.

Next, unzip to your desired directory – mine is in C:\7za920.

Based on my previous post, MySQL: Backup Database using Batch File. Add the following lines after echo Database Backups Completed and before pause.

cd C:\7za920
7za a D:\BACKUPS\myapp_%datestr%.sql >Log.txt 2>&1
echo Zipping Backups Completed

Now you are done! Execute the batch file to see the result!

p/s: >Log.txt 2>&1 used for creating a log file for all the process to zip the file.

Leave a Reply

Your email address will not be published. Required fields are marked *

17 − 7 =