Home > Commands N-Z > Commands S

SUBST


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

Associates a path with a drive letter.

The drive letter you assign represents a virtual drive, because you can use the drive letter in commands as if it were a physical drive.

Do not use the SUBST command when Win3.0+ is running.


Syntax

SUBST /?

SUBST [drive1: [drive2:]path]

SUBST drive1: /D

Display names of the virtual drives in effect:

SUBST


Parameters
drive1: (v3.1 Win95 NT3.5)
Specifies the virtual drive to which you want to assign a path.
drive2: (v3.1 Win95 NT3.5)
Specifies the physical drive that contains the specified path (if different from the current drive).
path (v3.1 Win95 NT3.5)
Specifies the path that you want to assign to a virtual drive.

Switches
/? (NTXP)
Displays help.
/D (v3.1 Win95 NT3.5)
Deletes a virtual drive.

Related

For information about increasing the number of available drive letters, see the LASTDRIVE command.
Also see UNDOCUMENTED command: TRUENAME.
NET USE - Map a drive letter to a network drive.


Notes
WIN2K: Access denied

Under Windows 2000 you may receive an "Access denied" error message. This behavior occurs if you are using a domain user account. (Q258625)


Recycler created against local shared folder

Notice that when SUBST is used against a local shared folder, it will create a RECYCLER for that drive. The RECYCLER is not removed when the drive substitution is removed, but can be deleted manually.


Using other commands with SUBST

These commands do not work, or should not be used, on drives used in the SUBST command:


Valid drive1 values

The drive1 parameter must be within the range specified by the LASTDRIVE command. If not, SUBST displays the error message:

    Invalid parameter - drive1:

Using SUBST with Microsoft Windows

Do not create or delete virtual drives using the SUBST command while Microsoft Windows is running. If you want to create or delete a virtual drive using the SUBST command, quit Windows, create or delete the virtual drive, and then start Windows again.


Using SUBST with compressed drives

You can use SUBST to associate a path on a compressed drive with a drive letter. However, the drive size and free space of the SUBST drive (for example, as reported by the DIR command) might not match the drive size and free space reported for the compressed drive.


Examples

This command creates a virtual drive Z for the path B:\USER\BETTY\FORMS:

    SUBST Z: B:\USER\BETTY\FORMS

Now, instead of typing the full path, you can reach this directory by typing the letter of the virtual drive, followed by a colon, as in:

    z:

This example works only if you have included the line LASTDRIVE=Z in your CONFIG.SYS file to define Z as the highest letter that the operating system recognizes as a disk drive. For more information, see the LASTDRIVE command.


Errorlevels

none.


Availability
External
DOS
v3.1 v3.21 v3.25 v3.30 v3.3A v3.3R v3.3T v3.31 v3.40 v4.0 v4.01 v4.01A 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 v8.00
Windows
Win95 Win98 WinME
Windows NT
NT3.5 NT4 NT2000 NTXP NT2003