Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I think the header explain the question. I want to do inside a bat-file:

zip /a /m myfile.log

where I just invented the zip comand and the options: /a add file /m Move file

It is run on Windows Server 2003.

share|improve this question
up vote 4 down vote accepted

you need to use an actual implementation of a zip program. take a look at gzip, bzip or 7zip. Each program will have different command line switches

share|improve this answer

I've used 7-Zip in batch files, this line for example compresses all *.bak files in a given folder:

FOR /f %%i in ('DIR /b D:\Backup\*.bak') DO "C:\Program Files\7-Zip\7z.exe" a -tbzip2 -mx3 D:\BackupCompressed\%%i.7z D:\Backup\SQLDaily\%%i

You have to download the right version of 7-Zip for your operating system (32 or 64 bit and use the 7z.exe).

Here is the link to a page with command line examples.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.