Use 7-zip to zip a file with a batch file

7-Zip will work in conjunction with a batch file, on Windows, to zip a file automatically. Install the program and copy 7z.exe to the system32 directory. The syntax is this:

7z a myfile

That’s it, kids. Note: I don’t really understand how 7-zip is different than other zip utilities, but, the archive which it creates must be extracted by the same program. Other programs will say that the archive is corrupt.

cd "C:\Documents and Settings\All Users\Application Data\
MYSQL\MySQL Server 5.5\data"
7z a myfile
move "C:\Inetpub\wwwroot\getit\"
cd "C:\Inetpub\wwwroot\getit"
ping -n 1 -w 600000>NUL


I use something like this to create an archive which I can then download at my house via “wget” and a Linux cron job. Bada-boom, bada-bing.

Leave a Reply