banner



How To Create Cab File

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!

How To Create Cab File

Source: https://superuser.com/questions/658021/whats-the-best-way-to-create-a-cab-file-of-multiple-files-quickly

Posted by: inmansomper.blogspot.com

0 Response to "How To Create Cab File"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel