wimextract - Man Page

Extract files from a WIM image

Synopsis

wimextract WIMFILE IMAGE [(PATH | @LISTFILE)...]  [OPTION...]

Description

wimextract, or equivalently wimlib-imagex extract, extracts one or more files or directory trees from the specified IMAGE contained in the Windows Imaging (WIM) archive WIMFILE.

wimextract is intended for extracting only a subset of a WIM image.  If you want to extract or "apply" a full WIM image to a directory or NTFS volume, use wimapply(1) instead.

IMAGE specifies the image in WIMFILE from which to extract the files or directory trees.  It may be the 1-based index of an image or the name of an image.  It may be omitted if WIMFILE contains only one image.  You can use wiminfo(1) to list the images contained in WIMFILE.

If no additional arguments are given, the entire WIM image is extracted. Otherwise, each additional argument is interpreted as a PATH if it does not begin with the '@' character, or a LISTFILE if it does.  Each PATH specifies a file or directory tree within the WIM image to extract, whereas each LISTFILE specifies a file that itself contains a list of paths to extract.  If a LISTFILE is "-" (i.e. the whole argument is "@-"), then the listfile is read from standard input.  See Paths and Listfiles for more details.

By default, files and directories are extracted to the current directory.  Use --dest-dir to select a different destination directory.  Alternatively, use --to-stdout to extract a file to standard output to pipe into another program.

A file or directory extracted from a PATH argument is by default extracted directly into the destination directory, whereas a file or directory extracted from a LISTFILE argument is by default extracted into the destination directory in such a way that the archive's directory structure is preserved.  Use --preserve-dir-structure to always get the latter behavior.

wimextract supports extracting files and directory trees from stand-alone WIMs as well as split WIMs.  See Split Wims.

Paths and Listfiles

Each path, including those on the command line and those in listfiles, must be specified as an absolute path starting from the root of the WIM image, like those output by wimdir(1).  However, path separators may be either forward or backward slashes, and the leading slash is optional.

On Windows, by default paths are treated case-insensitively, whereas on UNIX-like systems, by default paths are treated case-sensitively.  In either case, the default behavior may be overridden through the WIMLIB_IMAGEX_IGNORE_CASE environmental variable, as documented in wimlib-imagex(1).

By default, each path may contain the wildcard characters '?' and '*'.  The '?' character matches any non-path-separator character, whereas the '*' character matches zero or more non-path-separator characters.  Consequently, a single wildcard path, or "glob", may expand to multiple actual files or directories. Use the --no-globs option to disable wildcard matching and search for each path literally.

Each LISTFILE must be a text file (UTF-8 or UTF-16LE encoded; plain ASCII is also fine) that contains a list of paths to extract, one per line.  Wildcard characters are allowed by default.  The following demonstrates an example listfile:

; This is a comment (begins with semicolon)
# This is also a comment (begins with number sign)
/Users
/Windows/explorer.exe
/Windows/System32/en-US/*

; Both forward and backslashes are valid.
; It's not necessary to quote paths containing internal spaces.
\Program Files\A*

; Leading and trailing whitespace is ignored
    \Windows\notepad*

Split Wims

You may use wimextract to extract files or directory trees from a split WIM.  This uses the --refs="GLOB" option in the same way as in other commands such as wimapply.  See wimapply(1) for more details.

Options

--check

Before extracting the files, verify the integrity of WIMFILE if it contains extra integrity information.

--ref="GLOB"

File glob of additional WIMs or split WIM parts to reference resources from. See SPLIT_WIMS.  Note: GLOB is listed in quotes because it is interpreted by wimextract and may need to be quoted to protect against shell expansion.

--dest-dir=DIR

Extract the files and directories to the directory DIR instead of to the current working directory.

--to-stdout

Extract the files to standard output instead of to the filesystem.  This can only be provided if all the specified paths are to regular files (not directories or reparse points).  If present, named data streams are not extracted.

--unix-data

See the documentation for this option to wimapply(1).

--no-acls

See the documentation for this option to wimapply(1).

--strict-acls

See the documentation for this option to wimapply(1).

--no-attributes

See the documentation for this option to wimapply(1).

--include-invalid-names

See the documentation for this option to wimapply(1).

--no-globs

Do not recognize wildcard characters in paths.  Each path will be searched for literally.  In addition, if case insensitivity is enabled, do not allow a single path to match multiple files with the same case-insensitive name but different case-sensitive names.

--no-wildcards is also accepted as an alias for this option.

--nullglob

If a glob does not match any files, ignore it and print a warning instead of failing with an error.  In other words, this option allows a glob to successfully match zero files.

This option also affects paths that do not contain wildcard characters, since such paths are still considered globs unless --no-globs is enabled.  If case-insensitivity is enabled, such a glob could match multiple files with the same case-insensitive name but different case-sensitive names, whereas a non-glob path (with --no-globs) can match at most one file.

--preserve-dir-structure

When extracting paths, preserve the archive directory structure instead of extracting the file or directory tree named by each path directly to the destination directory.  Note: --preserve-dir-structure is already the default behavior for paths in listfiles, but not paths directly specified on the command line.

--wimboot

See the documentation for this option to wimapply(1).

--compact=FORMAT

See the documentation for this option to wimapply(1).

--recover-data

See the documentation for this option to wimapply(1).

Notes

See wimapply(1) for information about what data and metadata are extracted on UNIX-like systems versus on Windows.

Reparse-point fixups (a.k.a. changing absolute symbolic links and junctions to point within the extraction location) are never done by wimextract. Use wimapply if you want this behavior.

Unlike wimapply, wimextract does not support extracting files directly to an NTFS volume using libntfs-3g.

Examples

Extract a file from the first image in "boot.wim" to the current directory:

wimextract boot.wim 1 /Windows/System32/notepad.exe

Extract a file from the first image in "boot.wim" to standard output:

wimextract boot.wim 1 /Windows/System32/notepad.exe --to-stdout

Extract a file from the first image in "boot.wim" to the specified directory:

wimextract boot.wim 1 /Windows/System32/notepad.exe \

--dest-dir=somedir

Extract the "sources" directory from the first image in "boot.wim" to the current directory:

wimextract boot.wim 1 /sources

Extract multiple files and directories in one command:

wimextract boot.wim 1 /Windows/Fonts \

/sources /Windows/System32/cmd.exe

Extract many files to the current directory using a wildcard pattern:

wimextract install.wim 1 "/Windows/Fonts/*.ttf"

Extract files using a list file:

wimextract install.wim 1 @files.txt

...  where files.txt could be something like:

Windows\System32\*.*
Windows\System32\??-??\*.*
Windows\System32\en-US\*.*

See Also

wimlib-imagex(1) wimapply(1) wimdir(1) wiminfo(1)

Referenced By

wimapply(1), wimlib-imagex(1).

The man page wimlib-imagex-extract(1) is an alias of wimextract(1).

February 2024 wimlib 1.14.4