JSI Tip 8322. How do I extract a .CAB file in Windows XP, using the path information stored in the .CAB file?

Jerold Schulman

August 2, 2004

2 Min Read
ITPro Today logo in a gray background | ITPro Today

When you use the Expand command, it places all the files in the same folder.

When you type Expand /?, you receive:

Microsoft (R) File Expansion Utility  Version 5.1.2600.0Copyright (C) Microsoft Corp 1990-1999.  All rights reserved.Expands one or more compressed files.EXPAND [-r] Source DestinationEXPAND -r Source [Destination]EXPAND -D Source.cab [-F:Files]EXPAND Source.cab -F:Files Destination  -r            Rename expanded files.  -D            Display list of files in source.  Source        Source file specification.  Wildcards may be used.  -F:Files      Name of files to expand from a .CAB.  Destination   Destination file | path specification.                Destination may be a directory.                If Source is multiple files and -r is not specified,                Destination must be a directory.

You can use the Cabinet Tool, installed from the Support Tools folder of the CD-ROM.

When you type cabarc /?, you receive:

Microsoft (R) Cabinet Tool - Version 5.1.2600.0Copyright (c) Microsoft Corporation. All rights reserved..Usage: CABARC [options] command cabfile [@list] [files] [dest_dir]Commands:   L   List contents of cabinet (e.g. cabarc l test.cab)   N   Create new cabinet (e.g. cabarc n test.cab *.c app.mak *.h)   X   Extract file(s) from cabinet (e.g. cabarc x test.cab foo*.c)Options:  -c   Confirm files to be operated on  -o   When extracting, overwrite without asking for confirmation  -m   Set compression type [LZX:  -p   Preserve path names (absolute paths not allowed)  -P   Strip specified prefix from files when added  -r   Recurse into subdirectories when adding files (see -p also)  -s   Reserve space in cabinet for signing (e.g. -s 6144 reserves 6K bytes)  -i   Set cabinet set ID when creating cabinets (default is 0)  -d   Set diskette size (default is no limit/single CAB)Notes-----When creating a cabinet, the plus sign (+) may be used as a filenameto force a folder boundary; e.g. cabarc n test.cab *.c test.h + *.bmpWhen extracting files to disk, the , if provided, must end ina backslash; e.g. cabarc x test.cab bar*.cpp *.h d:testThe -P (strip prefix) option can be used to strip out path informatione.g. cabarc -r -p -P myproj a test.cab myprojballoon*.*The -P option can be used multiple times to strip out multiple pathsWhen creating cabinet sets using -d, the cabinet name should containa single '*' character where the cabinet number will be inserted.



Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like