Expand command

Updated: 11/12/2023 by Computer Hope
expand command

The expand command is used to take a compressed Windows file and "expand" it to its original form.

Availability

Expand is an external command and is available for the following Microsoft operating systems as expand.exe.

Expand command syntax

Windows Vista and later syntax

EXPAND [-R] Source Destination
EXPAND -R Source [Destination]
EXPAND -I Source [Destination]
EXPAND -D Source.cab [-F:Files]
EXPAND Source.cab -F:Files Destination
-R Rename expanded files.
-I Rename expanded files but ignore directory structure.
-D Display list of files in source.
Source Source file specification. Wildcards may be used.
-F:Files Name of files to expand from a .CAB file.
Destination Destination file | path specification.
Destination may be a directory.
If Source is multiple files and -r is not specified,
Destination must be a directory.

Windows XP and earlier syntax

EXPAND [-r] Source Destination
EXPAND -r Source [Destination]
-r Automatically rename expanded files. Only valid for files compressed with -r switch.
Source Source file specification. Source may be multiple file specifications. Wildcards may be used.
Destination Destination file and path specification. Destination may be a directory. If Source is multiple files and -r is not specified, Destination must be a directory. Wildcards may not be used.

Recovery console expand command syntax

Expands a compressed file.

EXPAND source [/F:filespec] [destination] [/Y]
EXPAND source [/F:filespec] /D
source Specifies the file to be expanded. May not include wildcard (* and ?) characters.
Destination Specifies the directory for the new file. The default is the current directory.
/y Do not prompt before overwriting an existing file.
/f:filespec If the source contains more than one file, this parameter is required to identify the< specific file(s) to be expanded. May include wildcards.
/d Do not expand; only display a directory of the files that are contained in the source.

The destination might be any of the system directories, the root of any drive, the local installation sources, or the cmdcons directory. The destination cannot be removable media. The destination file cannot be read-only. Use may use the attrib command to remove the read-only attribute. Expand prompts if the destination file already exists unless /Y is used.

Repair expand command syntax

Expands a compressed file.

EXPAND source [/F:filespec] [destination] [/Y]
EXPAND source [/F:filespec] /D
source Specifies the file to be expanded. May not include wildcards.
destination Specifies the directory for the new file. Default is the current directory.
/Y Do not prompt before overwriting an existing file.
/F:filespec If the source contains more than one file, this parameter is required to identify the specific file(s) to be expanded. May include wildcards.
/D Do not expand; only display a directory of the files that are contained in the source.

The destination might be any of the system directories, the root of any drive, the local installation sources, or the cmdcons directory.

The destination cannot be removable media.

The destination file cannot be read-only. Use the ATTRIB command to remove the read-only attribute.

EXPAND prompts if the destination file already exist unless /Y is used.

Expand examples

expand d:\i386\hal.dl_ c:\windows\system32\hall.dll

The command above expands the compressed version of the hall.dll file to the proper directory on the computer. All compressed files will end with an underscore. Therefore any Windows file you're attempting to replace can be substituted in the above example.