Subst

Index

The SUBST command designates a virtual drive to represent a path. The drive so assigned and the path represented can be used synonymously.

Syntax:

To assign a virtual drive name to a path:
SUBST drive: path

To cancel a virtual drive designation:
SUBST drive: /D

To display a list of current virtual drives:
SUBST
drive:The virtual drive to be created/released.
pathThe physical path to be assigned to the virtual drive.

Notes:

  1. The SUBST command is typically used in three circumstances:
    • To simplify referencing commonly used paths. Perhaps all data kept in the c:\program files\myfiles directory would be assigned to D:.
    • To simplify (and shorten) PATH statements. If several paths to be included in the search path have parts of their structure in common, it can make things simpler if the common part is assigned a substitute drive letter.
    • Some programs insist on running from a particular drive, even when that drive is not available or inconvenient to use. The path to be actually used can be assigned to the letter of the drive required.

  2. If the new virtual drive already exists (perhaps as a hidden host drive of a compressed disk), an error message is displayed stating that the specified drive is "an invalid parameter".

  3. A path that has been assigned to a drive letter via can still be accessed by its real name - ie. the SUBST command provides an alias, not a new name.

  4. The following commands will not work with virtual drives created using SUBST:
    DiskCopyFdiskChkDsk
    FormatSysLabel

  5. The TRUENAME command can be used to display the real path of a drive that has been reassigned using the SUBST command.

  6. Windows Explorer will show both the virtual drive and the actual path in its file listings. Interestingly, files from the real path can be copied to files in the virtual drive (and vice versa) without problem. However, the same operation in Dos gives the error message that a file cannot be copied onto itself and no files are copied.

  7. If a SUBST drive is listed in a PATH statement, PATH will sometimes display the SUBST path, and sometimes the true path. The rules appear to be:
    • If the "root" SUBST drive is added to the path, the SUBST drive is shown by PATH.
    • If the SUBST drive plus a valid subdirectory is added to the path, the true path is shown by PATH.
    • If the SUBST drive plus an invalid subdirectory is added to the path, PATH shows the SUBST drive.

Example:

To create a virtual drive called Z for the path "c:\data\docs\manuals\Dos":
SUBST z: c:\data\docs\manuals\Dos

Now, instead of typing the full path, this directory can be reached simply by typing "z:".

Exit Codes:

0The command was executed without errors
1An initialization error occurred.
Such an error would generally caused by insufficient memory or disk space, or invalid drive name or syntax).

File Details

File NameVersionSizeDateDefault Location
Subst.exe Win95: Upgrade17 90411/07/95c:\windows\command
Win95: OSR2.517 90424/08/96c:\windows\command

If you should have any comments or suggestions,
please contact: Bob Watson
.
This page last revised:
December 9, 1999.