Home > Commands A-M > Commands E

EXPAND


Description | Syntax | Parameters | Switches | Related | Notes | Examples | Errorlevels | Availability

Expands a compressed file. You can use this command to retrieve one or more files from the Setup disks that accompany v6.22. These files are not usable unless you expand them.


Syntax

EXPAND /?

EXPAND [-d] [-f] [-r] [drive:][path]filename [[drive:][path]filename [...]] destination

Prompt for the location and/or name to give the expanded file:

EXPAND [-r] [drive:][path]filename

Prompt for the location and name of the compressed file to expand, then prompt for the location and/or name to give the expanded file:

EXPAND


Parameters
drive: ( path filename v5.0 Win95 NT3.5)
Specifies the location and name of a compressed file or files to be expanded. You cannot use wildcards (* and ?).
destination (v5.0 Win95 NT3.5)
Specifies the location and/or name of the expanded file or files. Destination can consist of a drive letter and colon, a directory name, a filename, or a combination. However, you cannot specify a filename for destination unless you also specify a single compressed file for filename.

Switches
/? (NTXP)
Display help.
-d (NT2000)
Displays a list of files in the source location. Does not expand or extract the files.
-f (NT2000)
Specifies the files in a cabinet (.cab) file that you want to expand. You can use wildcards.
-r (NT3.5)
Rename expanded files.

Related

ATTRIB - Display or change file attributes.
COPY - Copy one or more files to another location.
Equivalent Linux BASH commands:
gzip - Compress or decompress named file(s).


Notes
Retrieving files from the Setup disks

Most of the files on the Setup disks provided with v6.22 are compressed. Each of these compressed files has a file extension that ends with an underscore character (_). When you installed the operating system, you ran the Setup program, which expanded these files before copying them to your system. However, if you need to retrieve just one or a few files from the original disks, you can use the EXPAND command.


Letting EXPAND prompt you

If you don't include the destination, or don't include the compressed file and the destination, EXPAND prompts you for the information and provides examples.


Examples

Suppose you accidentally delete the SORT.EXE file from your DOS directory on drive C. You can copy and expand the compressed file SORT.EX_ from the DOS v6.22 Setup disks to your hard disk. First, find out which disk contains SORT.EX_ by opening the PACKING.LST file on Setup Disk 1. Then insert the appropriate disk into drive A and use this command to copy and expand the file:

    EXPAND A:\SORT.EX_ C:\DOS\SORT.EXE

To copy and expand the SORT.EX_ file to the hard disk by letting EXPAND prompt you, type:

    EXPAND

EXPAND prompts you with:

    Type the location and name of the compressed file you
    want to expand. (Example: A:\EGA.SY_)
    Compressed file:

To expand and copy the SORT.EX_ file from the Setup disk in drive A, type:

    A:\SORT.EX_

EXPAND prompts you with:

Type the location and/or name you want to give the expanded file. (Example: C:\DOS\EGA.SYS)

    Expanded file:

If your operating system files are in the C:\DOS directory, type:

    C:\DOS\SORT.EXE

Errorlevels

none.


Availability
External
DOS
v5.0 v5.0A v5.00.02 v5.001A v5.01 v5.02 v6.0 v6.10 v6.2 v6.21 v6.22 v6.23 v7.00 v7.0R1 v7.10
Windows
Win95 Win98
Windows NT
NT3.5 NT4 NT2000 NTXP NT2003