Expand command

Deepak Gupta
Deepak Gupta December 7, 2021
Updated 2021/12/07 at 7:43 PM

Sometimes it is necessary get one or more files of the Windows installation. Either because one of these files has been deleted or has been damaged. The Windows recovery console is a tool that will allow you to access these files. But, a specific file is sometimes compressed together with others in files of the type .cab.

How to access these files? How to unzip them and access the internal files? Well, simply with the command expand of the Windows recovery console we can unzip the files .cab Windows and access its content.

If you want to know more about this command, as well as its syntax and characteristics, I invite you to continue reading. We already started.

What are CAB files?

The files.cab they are nothing more than Windows native cabinet files. The extension cab comes from english cabinet, which means closet or cabinet. That is, this type of file is used as container of other files.

Initially these files were called files Diamond. The files contained within these tablets are generally files related to Windows installations, such as device drivers or system files.

If we need to recover a file from the system that has been damaged or deleted, we can remove it from a file .cab own Windows installation.

What is the expand command?

The command expand can be used from the windows command line to extract files from compressed archives, either .cab or the classics .zip or .rar. Generally this command is used to extract system files or drivers from application installation files or the operating system in general.

Expand command availability

The expand command is present in all higher versions of MS-DOS 6.0. In addition, it is part of the Windows command line in its versions 2000 and XP. Also included in versions View, 7, 8 and 10. On the other hand, even with the large number of modifications made to the latest version of the operating system, Windows 11, this command can be accessible even from cmd.

Also, this command can be executed from the Windows recovery console.

Command syntax

The command expand can be used in different ways:

expand [/r /d /i] <source> <destination>
expand <source>.cab /f:<files> <destination>

Description of the expand command parameters

Parameters Meaning
/ r By using this parameter we are indicating that the files extracted from the compress should be renamed. The new name must be specified in the destination path.
/ i The parameter is similar to the previous one. The main difference is that the directory structures are ignored in the new file name.
/ d This parameter shows us the list of files that are inside the compress. When you run expand next to / d no file extraction will be carried out from the compressed files.
source It is used to specify the directory and the compressed file from which to extract. This directory must be made up of the drive letter followed by a colon. You must continue with the name of the folder or a combination of several of these and end with the compressed file.
destination This parameter is used to specify the destination path where the archive will be extracted from the archive. In case the source file has several files and the / r parameter is not used, this parameter must point to a directory. In case the / r parameter is used, this parameter will refer to a directory and the new file name.
/F:<files> This parameter is specific to .cab files. It allows the use of wildcard characters such as * or?.
/? It allows us to access the help regarding the expand command in the system.

Examples of using the expand command

Suppose we have a Windows XP operating system installation image mounted. The path of this image is d. So if we want to extract a file from the drivers of this image we execute the command

expand d: i386 hal.dl_ e: tmp

This execution copies the file from the i386 folder of our installation image to the tmp directory on drive e.

In addition, we can list all the files contained in the drivers.cab file that is inside the i386 folder of the Windows XP image used as an example. To perform this action we execute

expand /d d:i386driver.cab

In the output of the command you will be able to check the amount of files that are inside this compress, which by the way are quite a few. No file has been extracted, as you may have noticed. I recommend you make this list first so that you make sure that the file you are going to extract exists in the compressed format.

List of files in a tablet.

Once you know which file you want to extract from the archive .cab or from the tablet, you run the command

d:i386driver.cab /f:1394vdbg.sys e:tmp

In this case the command will copy the file 1394vdbg.sys from the tablet driver.cab to the directory tmp in unity d. It is important to clarify that for the files .cab it is necessary to indicate specifically which file is to be extracted.

Extract files from .cab archive

Share this Article
Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *