Windows – How to rebuild a Windows Image (WIM) using ImageX tool

command lineimagexwindowswindows 7windows 8

I've previouslly mounted a WIM image using DISM where I've removed some packages and then I've unmounted it commiting changes, and now I would like to rebuild the WIM file to save filesize and compression ratio.

I'm trying to follow the specifications of Microsoft help here but I think that I'm using the bad switch of the ImageX command for my intentions…

The command below throws an error saying that the directory name is not valid:

ImageX.exe /Check /Compress Maximum /Verify /Capture "C:\WinDVD\Sources\Install.wim" "1" "%UserpProfile%\Desktop\NEW Install.wim"

EDIT:
Now I've read about the /Export switch, but that is what I need? I want to save the full WIM file as is, not only a single image index.

Best Answer

Correct, you need the /Export parameter:

Imagex /export C:\WinDVD\Sources\install.wim 1 C:\WinDVD\exported\install.wim /compress maximum

(1 is the Index inside the WIM)