Thursday, October 20, 2005

MakeCab : Part 2 - Compress multiple files

To compress multiple files into a single CAB file, you need to use a directive file.
The directive file contain instruction how MakeCab should compress and package the files.

Below is a sample of the most basic directive file. Replace the file list with your actual files.


.OPTION EXPLICIT
 
.Set CabinetNameTemplate=mycab.CAB
 
.Set Cabinet=on
.Set Compress=on
 
"file1.pdf"
"file2.doc"
"This is a third file.doc"


All directive start with ".". Comment start with ";".

In the above example,
option explicit specify all variables must be declared before it is used.

CabinetNameTemplate specify the name of the output CAB file.

Cabinet specify whether include the files in the CAB file. When creating setup package, you can use this directive to exclude certain file such as setup.exe from being included into the CAB file.

Compress specify whether to compress the file.

The remaining lines specify the files to be included into the CAB file.

To compress the files using the directive file, run the following command:

makecab /f your_directive_file.ddf
.

Once completed, the CAB file will be created inside a folder named "disk1". Two more files, setup.inf and setup.rpt is also created. You can just take the CAB file and ignore the others.

5 Comments:

At 10:01 AM, Anonymous Anonymous said...

Do not use " around file name, it does not work.

 
At 7:08 PM, Anonymous Anonymous said...

It does work for me. use it in Notepad, and encode it as ANSI.

 
At 2:30 PM, Anonymous Anonymous said...

Thanks alot the ddf file worked wonders. now i can pack the instructions for our windows mobiles to set all the vallues for the exchange sync

 
At 4:49 PM, Blogger Santhosh said...

I was wondering how to tar files in windows ,makecab is the solution

 
At 4:50 PM, Anonymous sankdyl said...

I was wondering tar like command in windows,makecab is the solution

 

Post a Comment

<< Home