Know the wim format file and learn about the commands used to capture system images using the Dism tool.

  

What is a Wim file?

Wim is a new Windows
imaging format (Windows
Imaging Format) that Microsoft has adopted since Vista. If you have a Microsoft original ISO image in your hands, open the sources directory in the image and you will find two files in wim format: install.wim and boot.wim. The most important thing in the image is the two files. Just look at their size and you will know.

The install.wim file contains all the files of the operating system
that we want to install, which means that we only need the install.wim file, and then we can complete the system with the relevant tools. installation. So what is another boot.wim doing? When we boot the installation system from the USB flash drive or CD, we will first enter a micro- operating system
(WinPE, Microsoft official PE) called Windows pre-installation environment, and then start the installation program in this environment to complete the system installation. The system files related to WinPE are included in boot.wim.

What tools are used to process Wim files?

In the early days, we mainly used imagex tools to process wim image files. We need to install Windows AIK to get imagex. Of course, we can also download imagex from network
. In the era of Win8, the latest version of the Dism tool has been improved to have the original features of imagex, and has been included in win8/8.1 and Win8/8.1 PE.

Of course, there are other tools you can use to view files in Wim, such as 7z. No introduction here.

Using the DISM tool to load files from a specified directory into a Wim file

We will use an example to demonstrate the specific process of loading a file in a specified directory into a Wim file using DISM: Br>

In order to better illustrate the problem, we can make an image metaphor. We compare a wim file to a container, we can split the container into several grids, and then store the files in each grid. Now all I have to do is: put all the files in my computer

D:\\songs folder into the wim file and occupy a grid. The name of the grid is NO.1. And put the final generated wim file named songs.wim into D:\\. The specific operation is:

1. First, we create a folder named temp in D:\\, and use this folder as the cache directory during the operation. Note: This step is not really necessary, but because in the following article we want to back up the system in the recovery environment, in order to avoid errors caused by the default cache space is too small, so set this cache folder.

2. Run the command prompt as an administrator. Enter the following command directly and press Enter:

Dism /Capture-Image /ImageFile:D:\\songs.wim /ScratchDir: D:\\Temp /CaptureDir:D:\\songs /Name:NO.1

The meaning of each path in the command, I don’t think I need to introduce it. I believe you with the purpose we want to achieve. Can understand. The Capture-Image here means the meaning of capturing the image. After the operation is completed, look up in D:\\ to see if a file named songs.wim is generated. By the way, look at its size.

3, now we add a few files to the D:\\songs folder, and then put all the files in D:\\songs into another grid in songs.wim, corresponding The name of the grid is called NO.2. To achieve this, we only need to enter the following command at the command prompt, press Enter.

Dism /Append-Image /ImageFile:D:\\songs .wim /ScratchDir:D:\\Temp /CaptureDir:D:\\songs /Name:NO.2

Please compare the differences between the above two commands, because we capture the file for the second time. It is based on the songs.wim file generated after running the first command, so the /Append-Image command is used, that is, the grid (image) is added on the basis of the original. In addition, we use different grid names, but in fact DISM allows different images to have the same name. We use different names to make it easy to distinguish them.

4. Finally, let's take a look at what is included in songs.wim. Operation method:

Enter the following command at the command prompt, press Enter: Dism /get-wiminfo /wimfile:D:\\songs.wim

The above picture is displayed in detail The number of grids (ie the number of images) contained in the songs.wim file shows that the second image is slightly larger than the first image. But let's take a look at the size of the songs.wim file and find that the size does not change much compared to the first time it was first generated. This is because most of the files in these two grids are the same, and the mechanism for storing files in wim can handle these same files very well, so that duplicate files do not take up extra space. This is why the size of images that contain multiple versions of the system does not increase exponentially.

About Wim and DISM, I have introduced so much for the time being. The above example just puts ordinary files into Wim files. If we want to back up the system, we can't operate directly in the system, but need to be in PE or restore. Operate in the environment or in another system (if multiple systems are installed). For more usage DISM after there is a chance to add



Copyright © Windows knowledge All Rights Reserved