Skip navigation

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

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.0
Copyright (C) Microsoft Corp 1990-1999.  All rights reserved.

Expands one or more compressed files.

EXPAND \[-r\] Source Destination
EXPAND -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.0
Copyright (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 filename
to force a folder boundary; e.g. cabarc n test.cab *.c test.h + *.bmp

When extracting files to disk, the <dest_dir>, if provided, must end in
a backslash; e.g. cabarc x test.cab bar*.cpp *.h d:\test
The -P (strip prefix) option can be used to strip out path information
e.g. cabarc -r -p -P myproj\ a test.cab myproj\balloon\*.*
The -P option can be used multiple times to strip out multiple paths

When creating cabinet sets using -d, the cabinet name should contain
a single '*' character where the cabinet number will be inserted.



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish