[Undocumented] Expand.exe

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
carlos
Expert
Posts: 503
Joined: 20 Aug 2010 13:57
Location: Chile
Contact:

[Undocumented] Expand.exe

#1 Post by carlos » 24 Nov 2012 21:06

Time ago I studied and use the Expand.exe utility.
Now I explain what are the types of compressed files that it support (using Windows 7).

The expand.exe decompress any CABINET file (it are files with the extension .cab or for example with a extension that end with underscore, example: .ex_).
This files internally begin with a header that says:

Code: Select all

MSCF

The cabinet files can be compressed with these type of compression:

Code: Select all

MSZIP
LZX
QUANTUM
NONE


You can expand any cabinet files with all these types of compression.
For example, currently you cannot make a cabinet file using QUANTUM or NONE compression with the utility makecab.exe or compress.exe, but you can expand or decompress it with the Expand.exe. Makecab.exe and Compress.exe lost support for it compression types, but not Expand.exe (since version 5 from windows 2000).

This is good, because in some cases you get smaller files using QUANTUM compression than MSZIP or LZX. Then if you create a cabinet files with these compression, you can expand it anyways. You not get a message like: The compression type of the file is not supported.

Now, how I can use these types of compression? All examples if you have a file called file.ext

MSZIP: makecab.exe, compress.exe

Code: Select all

Makecab.exe file.ext file.ex_
Makecab.exe /D CompressionType=MSZIP file.ext file.ex_
Compress.exe -Z file.ext file.ex_


LZX: makecab.exe, compress.exe (version 5.2.3790.0)
memory: 15 to 21.

Code: Select all

Makecab.exe /D CompressionType=LZX /D CompressionMemory=15 file.ext file.ex_
Makecab.exe /D CompressionType=LZX /D CompressionMemory=16 file.ext file.ex_
Makecab.exe /D CompressionType=LZX /D CompressionMemory=17 file.ext file.ex_
Makecab.exe /D CompressionType=LZX /D CompressionMemory=18 file.ext file.ex_
Makecab.exe /D CompressionType=LZX /D CompressionMemory=19 file.ext file.ex_
Makecab.exe /D CompressionType=LZX /D CompressionMemory=20 file.ext file.ex_
Makecab.exe /D CompressionType=LZX /D CompressionMemory=21 file.ext file.ex_
Compress.exe -ZX file.ext file.ex_


QUANTUM: old compress.exe (version 5.00.2134.1)
levels: 1 to 7.

Code: Select all

Compress.exe -zq1 file.ext file.ex_
Compress.exe -zq2 file.ext file.ex_
Compress.exe -zq3 file.ext file.ex_
Compress.exe -zq4 file.ext file.ex_
Compress.exe -zq5 file.ext file.ex_
Compress.exe -zq6 file.ext file.ex_
Compress.exe -zq7 file.ext file.ex_


NONE: makecab.exe, cabarc.exe (version 1.00.0601)

Code: Select all

Makecab.exe /D Compress=Off file.ext file.ex_
Cabarc.exe -m NONE N file.ex_ file.ext


When I make a cabinet file I test all these compression and I use the better (that generate the smallest file). For example, in larger files almost always is best the LZX compression, but in small files sometimes is better MSZIP or QUANTUM. For example I have a small executable of 1186 bytes.
Using best Quantum I get 389 bytes
Using MSZIP I get 423 bytes
Using best LZX I get 471 bytes
Using NONE I get 1267 bytes

But in larger files almost always is best the LZX. The trick is test all these compression types, Expand.exe (since version 5 from windows 2000) support all. Note: Expand version 2.5 from windows nt NOT support LZX, but yes MSZIP, QUANTUM and NONE.
Last edited by carlos on 09 Jan 2013 11:59, edited 4 times in total.

RogerSmith
Posts: 22
Joined: 20 Nov 2012 12:42

Re: [Undocumented] Expand.exe

#2 Post by RogerSmith » 09 Dec 2012 03:56

Hey hi!

Nice post!!!

Is NONE realy a compressing type? It seem to me that compressor just inject some bytes in to file... see in your example with "none compression" you get a file bigger than the original.

carlos
Expert
Posts: 503
Joined: 20 Aug 2010 13:57
Location: Chile
Contact:

Re: [Undocumented] Expand.exe

#3 Post by carlos » 04 Jan 2013 09:09

Roger, really NONE is a compression type option, but it not compress. I add the info of choose this option with makecab.exe (/D Compress=Off)
Last edited by carlos on 04 Jan 2013 12:22, edited 1 time in total.

carlos
Expert
Posts: 503
Joined: 20 Aug 2010 13:57
Location: Chile
Contact:

Re: [Undocumented] Expand.exe

#4 Post by carlos » 04 Jan 2013 09:40

[Continuation]

Now. I write about the option -D of Expand.exe.
This option show a list of the files that have a cabinet file. But this option have a little problem. It not show the full path of the file. Files inside a cabinet file can have a path name (not absolute path). This means that inside a cabinet file you can have a file with this type of name. For example:

creating a cabinet file with path name

Code: Select all

Md mypath
Echo nothing>mypath\file.txt
Cabarc.exe -p -m NONE n file.tx_ mypath\file.txt


file.tx_ in a hexadecimal editor looks this:

Code: Select all

0000   4D 53 43 46 00 00 00 00 5D 00 00 00 00 00 00 00   MSCF....].......
0010   2C 00 00 00 00 00 00 00 03 01 01 00 01 00 00 00   ,...............
0020   00 00 00 00 4C 00 00 00 01 00 00 00 09 00 00 00   ....L...........
0030   00 00 00 00 00 00 24 42 E8 63 20 00 6D 79 70 61   ......$B.c .mypa
0040   74 68 5C 66 69 6C 65 2E 74 78 74 00 04 01 1A 65   th\file.txt....e
0050   09 00 09 00 6E 6F 74 68 69 6E 67 0D 0A            ....nothing..


Then if you use the Expand.exe -D option this show:

Code: Select all

C:\folder>Expand.exe -D file.tx_
Microsoft (R) Utilidad de expansión de archivos versión 6.1.7600.16385
Copyright (c) Microsoft Corporation. Reservados todos los derechos.

file.tx_: file.txt




The -D option hide the path of files when it have. This is not good, because if you expand the file using Expand.exe it make the folder mypath\ and the file file.txt inside it.

carlos
Expert
Posts: 503
Joined: 20 Aug 2010 13:57
Location: Chile
Contact:

Re: [Undocumented] Expand.exe

#5 Post by carlos » 09 Jan 2013 12:00

Updated the first post adding note about expand version of windows nt.

Post Reply