Create compressed .CAB file. A .CAB Cabinet file is a Lossless Data Compression format.

      MAKECAB [/V[n]] [/D var=value ...] [/L dir] source [destination]

      MAKECAB [/V[n]] [/D var=value ...] /F directive_file [...]

   source         File to compress.

   destination    File name to give compressed file.  If omitted, the
                  last character of the source file name is replaced
                  with an underscore (_) and used as the destination.

   /F directives  A file containing directives for MAKECAB to use (may be repeated).
                  If more than one directive file is specified (/F file1 /F file2 ...), they
                  are processed in the order (left to right) specified on the command line.

                  Variable settings, open cabinets, open disks, etc. are all carried forward
                  from one directive file to the next (just as if all of the files had been
                  concatenated together and presented as a single file to MakeCAB).
                  For example, this is intended to simplify the work for a product shipped in
                  multiple languages. There would be a short, language-specific directives file, 
                  and then a single, master directives file that covers the bulk of the product.

   /D var=value   Defines variable with specified value. (may be repeated).
                  Equivalent to using .Set in a directives file.
                  For example, a single directive file could be used to produce layouts
                  for different disk sizes by running MakeCAB once with different values of
                  MaxDiskSize defined: /D MaxDiskSize=1.44M. Both standard MakeCAB variables
                  and custom variables can be defined in this way.

                  If .Option Explicit is specified in a directive file,
                  then variable must be defined with a .Define command in a directive file.
                  To use a variable substitution (as in the directive file with %)
                  use double %%

   /L dir         Folder location to place destination file (default is current directory).
                  most useful when destination is not specified.

   /V[n]          Verbosity level (1..3)  1=default, 3=Verbose. ( 0=none undocumented )

A single CAB file can be used to store a maximum of 65,535 files with a total size of up to 1.99 GiB. To compress multiple files into a single CAB file, use a directive file containing a list of the files to compress and package.

The default destination name is constructed from the source file name plus an extension that can be defined via the CompressedFileExtensionChar variable. ( MAKECAB /D CompressedFileExtensionChar=c ).

MakeCAB replaces an older utility CABARC.
On Windows Server the DIANTZ command is an synonym for Makecab.
The MakeCAB defaults are configured for a floppy disk layout.


Create a .CAB archive containing a single file:

C:\> makecab "recording.wav" "" /L "C:\Archive"

Create a .CAB archive containing multiple files, first create SS64.ddf as a plain text file:

;    CabinetNameTemplate is the name of the output CAB file:
.Set CabinetNameTemplate=Destination.CAB
.Set Cabinet=on
.Set Compress=on

C:\> makecab /F SS64.ddf

Create a self extracting archive containing

C:\> makecab ""
C:\> copy /b "%windir%\system32\extrac32.exe"+"" "movie.exe"
C:\> del /q /f ""

“One resolution I have made, and try always to keep, is this: To rise above little things” ~ John Burroughs

Related commands

EXTRACT - Uncompress CAB files.
EXPAND - Uncompress one or more compressed files.
GenChr.cmd - Generate an ASCII/Unicode character.
IEXPRESS - Create a self extracting ZIP file archive.
COMPACT - Compress files or folders on an NTFS partition.
IEXPRESS - Create a self extracting ZIP file archive.
Compress-Archive - PowerShell.
TAR - Store, list or extract files in an archive.

Copyright © 1999-2024
Some rights reserved