I would like to make a .cab file of multiple files. Any tutorial or guide I've come across is only useful for a few files.

  • Questions seeking product, service, or learning material recommendations are off-topic because they tend to become obsolete quickly. Instead, describe your situation and the specific problem you're trying to solve. Here are a few suggestions on how to properly ask this type of question. Oct 12, 2013 at 18:49
  • 3
    @DoktoroReichard This question is not asking for product or tutorial recommendations (the answer could be one but this is not off-topic). It is only saying all the tutorial and guides used before were not useful. The author is not asking for a recommendation but clearly for the way to do it in the title and of course this is not off topic.
    – laurent
    Oct 12, 2013 at 19:51
  • @laurent not to make this into a debate, but the OP didn't state any tutorial or guide that he read in the question, and what's the best x-category type of questions (read the last link) lead to product recommendations. I assume if someone would take the time to reformat this question it would be a valid one. Oct 12, 2013 at 19:58

4 Answers 4


According to Wikipedia:

The CAB file format may employ the following compression algorithms:

  • DEFLATE – invented by Phil Katz, the author of the ZIP file format
  • Quantum compression – licensed from David Stafford, the author of the Quantum archiver
  • LZX – invented by Jonathan Forbes and Tomi Poutanen, given to Microsoft when Forbes joined the company

As such, any .zip compressor should open the file, even the one that's native with all recent Windows versions.

However, and as the article indicates, there are few archivers that create .cab files, due to their format. According to the following list these programs can write .cab files:

  • ZipGenius
  • AlZip
  • IZArc
  • PowerArchiver
  • TugZip
  • WinAce
  • Tried until I got to IZArc. It made .cab files correctly. AIZip does not create .cabs. ZipGenius just doesn't seem to work (you tell it to create a .cab and then it does nothing). I am so surprised a Google search about creating .cab files didn't bring this up. Thanks a lot. Oct 12, 2013 at 19:08

You can use the Windows built-in command makecab but first you need to generate a file list.

dir C:\FolderName /s /b /a-d > c:\temp\files.txt

This will list all files in the C:\FolderName directory and save as a text file with full path name. Now we are going to use the files.txt file to create the cab file.

makecab /d CabinetName1=test.cab /D DiskDirectoryTemplate=C:\temp /f c:\temp\files.txt

The above command will generate a test.cab file in your C:\Temp folder using the file list generated earlier.

Additional helpful reference: Microsoft Cabinet Reference. and makecab.exe details.

  • It tells me A positional parameter cannot be found that accepts argument '/b'. with the first command.
    – Tvde1
    Apr 29, 2019 at 12:27
  • @tvde1, please check your syntax. The /b tells the output should only include bare path. Try this command "dir /?" For more details. Apr 29, 2019 at 13:53
  • @anonymouscoward It worked using the cmd terminal not PowerShell. a-d is wrong, the correct is a:-d. In makecab I had to pass a disk size using /d otherwise it would create floppy disk size cabinets
    – Clodoaldo
    May 22, 2019 at 18:40
  • You're using dir to check directories recursively with the /s switch, but you're not making the CAB file with the same directory structure. So what you get is all the files with none of the directory structure. Jan 8, 2021 at 12:43

"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."

Directive file (list.txt):

.Set CabinetNameTemplate=Out.cab;
.Set Cabinet=on;
.Set Compress=off;
.Set DiskDirectoryTemplate=;

Optionally, set compress to on (to save space), then enter command in cmd:

makecab /f list.txt

To create a self extracting archive:

copy /b "%windir%\system32\extrac32.exe"+"Out.cab" CABfiles.exe

Tested on Win 10 CMD.


Do you need to update or regenerate a CAB file, maybe replace a single file in an existing CAB while preserving the folder structure in the CAB? That's what I needed to do. Quick research revealed no simple 7Zip or WinZip way to update an existing CAB in place. I found a success path via regenerating a new CAB file, just like the old CAB file, except with my handful of modified files in it.

The tool that does this is a GUI front end to the MakeCab utility. MakeCab, with the right command line, will create a CAB file from all files in a folder.
Get MakeCab here: https://github.com/sapientcoder/CabMaker

The workflow to create an updated CAB file is:

  1. Open a Command Line, and use the Expand command to extract the files from the existing CAB file to a folder structure.

expand -F:* \MyServer\ServerMigration2020\ExportedConfigurationSourceFiles\MyOriginalCABFile.cab \MyServer\CaptureSV\ServerMigration2020\Cabfiles\CabSourceFiles

This Expand command extracts all the files inside your original CAB file and places them in the folder CabSourceFiles, preserving the folder structure.

  1. Make whatever updates you want to the extracted files and folders. In my case, there was one file, an XML file, I replaced within the folder structure.

  2. Run the CabMaker GUI to create your updated CAB file. Note that this works for a "plain" CAB file of just files and folders, not an "installer" CAB file that has extra headers and such as part of a set of installer files.

OK, how to obtain and use the CabMaker tool?
Get it here: https://github.com/sapientcoder/CabMaker I simply downloaded the CabMaker C# code from GitHub and ran it in Visual Studio 2019, with no changes.

The CabMaker GUI came right up. I entered my Source folder (the output folder in the Expand command), and my Target folder (where the resulting CAB file gets placed), and my desired CAB file name, and clicked the "Make CAB" button, and it ran. The resulting CAB file worked beautifully, and imported successfully into the app and resulted in a correctly set configuration.

CabMaker GUI screen shot

OK, so why did I need to make a CAB file? Well, we were migrating a vendor app from an old server to a new server, and using the app's "export" function to capture current state configuration files that we could "import" into the app on the new server. the alternative was to use the clunky GUI of the consumer app to manually navigate around and make a couple hundred changes to file and folder names that had changed. I decided it would be better to make the file and folder changes in the XML file within the CAB that held all the settings. It all worked out beautifully on server cutover day; sometimes we get lucky. Major kudos to GitHub contributor SapientCoder!

  • 2
    It is good to have confirmation that 7-Zip cannot create CAB files. That's the question I was pondering.
    – Ben
    Dec 21, 2020 at 17:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .