WIM extraction

Overview

Wim is Microsoft Windows image format. You can extract such an archive with Aspose.Zip similarly as other archives. It can contain several images, each of them is represented by WimImage class. We can to extract content of the images constituting the archive.

Extract Image

This sample extracts two images of an archive, each to own directory.

1try (WimArchive wimArchive = new WimArchive("boot.wim")) {
2    wimArchive.getImages().get_Item(0).extractToDirectory("extracted0");
3    wimArchive.getImages().get_Item(1).extractToDirectory("extracted1");
4}

Extract Files

This sample extracts each file entry of the first image to the directory.

1try (WimArchive wimArchive = new WimArchive("boot.wim")) {
2    for (WimEntry entry : wimArchive.getImages().get_Item(0).getAllEntries()) {
3        if (entry instanceof WimFileEntry) {
4            WimFileEntry winFileEntry = (WimFileEntry) entry;
5            winFileEntry.extract("extracted/" + winFileEntry.getName());
6        }
7    }
8}
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.