1 .TH WIMLIB-IMAGEX "1" "March 2016" "wimlib 1.9.1" "User Commands"
3 wimlib-imagex-update \- Update a WIM image
5 \fBwimlib-imagex update\fR \fIWIMFILE\fR [\fIIMAGE\fR] [\fIOPTION\fR...] [< \fICMDFILE\fR]
7 \fBwimlib-imagex update\fR modifies the specified \fIIMAGE\fR in the Windows
8 Imaging (WIM) file \fIWIMFILE\fR by adding, deleting, or renaming files or
10 This command is also available as simply \fBwimupdate\fR if the appropriate
11 hard link or batch file has been installed.
13 \fIIMAGE\fR specifies the image in \fIWIMFILE\fR to update. It may be a 1-based
14 index of an image in the WIM or the name of an image in the WIM. Use the
15 \fBwimlib-imagex info\fR (1) command to list the images a WIM file contains.
16 \fIIMAGE\fR may be omitted if \fIWIMFILE\fR contains only one image.
18 The modifications to perform on the WIM image are specified as a sequence of
19 commands, one per line, read in a text file from standard input. It is
20 recommended that standard input be redirected from a file (\fICMDFILE\fR), as
21 shown above, rather than typing in commands interactively. Alternatively, to
22 specify a command directly on the command line, see the \fB--command\fR option.
23 .SH AVAILABLE COMMANDS
24 This section documents the commands that may appear in the \fICMDFILE\fR
26 .SS \fBadd\fR [\fIOPTION\fR...] \fISOURCE\fR \fIDESTINATION\fR
27 Add a file or directory tree to the WIM image. \fISOURCE\fR must specify the
28 path to a file or directory on your filesystem. \fIDESTINATION\fR must specify
29 the path inside the WIM image at which to add the file or directory tree.
31 If \fIDESTINATION\fR names an existing directory in the WIM image, then
32 \fISOURCE\fR must also name a directory. This causes the contents of the
33 \fISOURCE\fR directory to be added to the \fIDESTINATION\fR directory.
35 If \fIDESTINATION\fR names an existing nondirectory file in the WIM image, then
36 \fISOURCE\fR must also name a nondirectory file. By default, this causes the
37 \fIDESTINATION\fR file to be replaced with the \fISOURCE\fR file. Or, with
38 \fB--no-replace\fR specified, this generates an error.
40 If \fIDESTINATION\fR does not exist in the WIM image, then any prerequisite
41 directories are created as needed to add the \fISOURCE\fR at that location.
43 The \fBadd\fR command supports a subset of the options accepted by
44 \fBwimlib-imagex capture\fR; namely, \fB--dereference\fR,
45 \fB--unix-data\fR, \fB--no-acls\fR, and \fB--strict-acls\fR. See
46 \fBwimlib-imagex-capture\fR (1) for explanations of these options.
48 In addition, the \fBadd\fR command supports the \fB--no-replace\fR option, which
49 causes the \fBadd\fR command to refuse to overwrite existing nondirectory files
51 .SS \fBdelete\fR [\fIOPTION\fR...] \fIPATH\fR
52 Delete a file or directory tree from the WIM image. \fIPATH\fR must specify the
53 path inside the WIM image of the file or directory tree to delete.
55 The available options for the \fBdelete\fR command are:
58 Do not issue an error if the path to delete does not exist.
61 Delete the file or directory tree recursively; if not specified, an error is
62 issued if the path to delete is a directory.
63 .SS \fBrename\fR \fIOLD_PATH\fR \fINEW_PATH\fR
64 Rename a file or directory tree inside the WIM image. \fIOLD_PATH\fR must
65 specify the old path of the file or directory tree inside the WIM image, and
66 \fINEW_PATH\fR must specify the new path for the file or directory tree. This
67 command follows the semantics of the POSIX \fBrename\fR (3) function; in
68 particular, a pre-existing file at \fINEW_PATH\fR will be deleted if present,
69 except in certain cases such as attempting to rename a directory to a
70 non-directory, which is not allowed.
72 There are no options available for the \fBrename\fR command.
74 The following options are accepted on the command line by \fBwimlib-imagex
78 Use \fB--dereference\fR for all \fBadd\fR commands.
81 Use \fB--unix-data\fR for all \fBadd\fR commands.
84 Use \fB--no-acls\fR for all \fBadd\fR commands.
87 Use \fB--strict-acls\fR for all \fBadd\fR commands.
90 Use \fB--no-replace\fR for all \fBadd\fR commands.
92 \fB--config\fR=\fIFILE\fR
93 Set the capture configuration file for all \fBadd\fR commands. See the
94 description of this option in \fBwimlib-imagex-capture\fR (1).
97 Use \fB--force\fR for all \fBdelete\fR commands.
100 Use \fB--recursive\fR for all \fBdelete\fR commands.
103 When reading \fIWIMFILE\fR, verify its integrity if the integrity table is
104 present; in addition, include an integrity table in the updated WIM. If this
105 option is not specified, an integrity table will be included in the updated WIM
106 if and only if one was present before.
108 \fB--threads\fR=\fINUM_THREADS\fR
109 Number of threads to use for compressing newly added files. Default: autodetect
110 (number of processors).
113 Rebuild the entire WIM rather than appending the updated data to the end of it.
114 Rebuilding the WIM is slower, but will save a little bit of space that would
115 otherwise be left as a hole in the WIM file.
117 See \fBwimlib-imagex-optimize\fR (1) for a more customizable way of
118 rebuilding (and optionally recompressing) a WIM file. If running
119 \fBwimlib-imagex optimize\fR after \fBwimlib-imagex update\fR, there is
120 no need to specify \fB--rebuild\fR to \fBwimlib-imagex update\fR.
122 \fB--command\fR=\fISTRING\fR
123 Instead of reading update commands from standard input, read a single update
124 command directly from the string \fISTRING\fR specified on the command line.
125 This option cannot be provided more than one time and cannot be used to specify
126 more than one update command. Note that the \fISTRING\fR, as well as any
127 paths containing spaces within the \fISTRING\fR must be appropriately quoted.
128 If running from cmd.exe on Windows, you should use double quotes for the outer
129 quotes and single quotes for the inner quotes. Example:
134 wimlib-imagex update boot.wim 1 \\
137 --command="add 'C:\\My Dir' '\\My Dir'"
143 This option is provided for convenience only. Do not execute
144 \fBwimlib-imagex update\fR multiple consecutive times, each time passing the
145 \fB--command\fR option! This is inefficient. Instead, generate an update
146 command file and provide it (on standard input) to a single invocation of
147 \fBwimlib-imagex update\fR, as explained in this document.
149 \fB--wimboot-config\fR=\fIFILE\fR
150 If this option is specified, no commands shall be read from standard input, and
151 instead the following command shall be executed:
156 \fBadd\fR \fIFILE\fR /Windows/System32/WimBootCompress.ini
161 This sets \fIFILE\fR as the WIMBoot configuration file for the image. The
162 [PrepopulateList] section of this file specifies path globs that shall not be
163 extracted as WIMBoot pointer files (perhaps due to being needed early in the
164 boot process). See the documentation for the \fB--wimboot\fR option of
165 \fBwimlib-imagex apply\fR (1) for more information.
167 \fB--unsafe-compact\fR
168 Compact the WIM archive in-place and append any new data, eliminating "holes".
169 In general, this option should \fInot\fR be used because a failed or interrupted
170 compaction will corrupt the WIM archive. For more information, see the
171 documentation for this option in \fBwimlib-imagex-optimize\fR (1).
173 \fBwimlib-imagex update\fR is partly redundant with \fBwimlib-imagex
174 mountrw\fR, since if a WIM image can be mounted read-write, then there
175 theoretically is no need for \fBwimlib-imagex update\fR. The main advantage
176 of \fBwimlib-imagex update\fR is that it works on both UNIX-like systems and
177 Windows, whereas \fBwimlib-imagex mountrw\fR is only available on UNIX-like
178 systems, and even then it only works on those with a compatible FUSE
181 Symbolic links inside a WIM image are not dereferenced when being interpreted.
182 So, for example, if you have a WIM image that contains a symbolic link
183 "/Documents and Settings" -> "/Users" where "/Users" is a directory, then a
184 subdirectory named "Public" in this directory must be specified as
185 "/Users/Public" rather than "/Documents and Settings/Public".
187 All paths to files or directories within the WIM image must be specified
188 relative to the root of the image. However, the leading slash is optional, and
189 both forward slashes and backslashes are accepted. In addition, on Windows, the
190 paths are by default treated case-insensitively, while on UNIX-like systems, the
191 paths are by default treated case-sensitively. The default case sensitivity may
192 be changed by setting the \fBWIMLIB_IMAGEX_IGNORE_CASE\fR environmental
195 The command file (\fICMDFILE\fR) is parsed by \fBwimlib-imagex update\fR
196 itself and not by the system shell. Therefore, its syntax is limited. However,
197 comment lines beginning with '#' are allowed, and it is also possible to quote
198 arguments with whitespace inside them.
200 On UNIX-like systems, you cannot use \fBwimlib-imagex update\fR to add files
201 to an image directly from an NTFS volume using libntfs-3g, even though
202 \fBwimlib-imagex capture\fR supports capturing a full image this way.
204 Except when using \fB--unsafe-compact\fR, it is safe to abort a \fBwimlib-imagex
205 update\fR command partway through; however, after doing this, it is recommended
206 to run \fBwimlib-imagex optimize\fR to remove any data that was appended to the
207 physical WIM file but not yet incorporated into the structure of the WIM, unless
208 \fB--rebuild\fR was specified, in which case you should delete the temporary
211 All the examples below show the update command file to be created as well as the
212 \fBwimlib-imagex update\fR command to run to perform the updates.
214 Delete two files from a WIM image:
217 \fIupdate_commands.txt\fR:
222 delete /sources/setup.exe
228 $ wimlib-imagex update boot.wim 2 < update_commands.txt
231 Add some files and directories to a WIM image. Note that the first path of each
232 \fBadd\fR command specifies the files to add, while the second path of each
233 \fBadd\fR command specify the locations at which to to add them inside the WIM
237 \fIupdate_commands.txt\fR:
242 add somefile /dir/file
248 $ wimlib-imagex update boot.wim 2 < update_commands.txt
251 Rename a file inside a WIM image.
254 \fIupdate_commands.txt\fR:
258 rename /dir_in_wim/oldfile.txt /dir_in_wim/newfile.txt
264 $ wimlib-imagex update boot.wim 2 < update_commands.txt
267 Using additional features, such as comments, options, and overlays, and
268 including an integrity table in the updated WIM:
271 \fIupdate_commands.txt\fR:
276 # This file specifies some changes to make to a WIM image.
279 # Add a new directory containing files I want in the image.
280 # The quotes are necessary because the directory name
282 add "My Directory" "/My Directory"
284 # Add the contents of "Another Directory" to the
285 # "/My Directory" we just created in the WIM image. Since
286 # the destination path already exists, this performs an
288 add "Another Directory" "/My Directory"
290 # Rename some file for some reason.
291 rename /dir_in_wim/oldfile.txt /dir_in_wim/newfile.txt
293 # Delete an unwanted directory.
294 delete --recursive /Users/Me/Documents/Junk
300 $ wimlib-imagex update boot.wim 2 --check < update_commands.txt
304 .BR wimlib-imagex (1)
305 .BR wimlib-imagex-capture (1)
306 .BR wimlib-imagex-info (1)
307 .BR wimlib-imagex-mountrw (1)
308 .BR wimlib-imagex-optimize (1)