Subst - DOS/Command Prompt Reference
Assigns a specific directory as a new (virtual) drive.
Syntax
subst[.exe] [<drive-letter>: [<exist-drive>:]<path>]
subst[.exe] <drive-letter>: /D
Options
* If no parameters are specified, it displays the current drive assignments made by the ‘subst’ command.
<drive-letter> | Specifies the drive letter. When creating a new one, you cannot specify a drive letter that already exists. To delete, it must be a drive created by ‘subst’. |
[<exist-drive>:]<path> |
Specifies an existing directory to be the root directory of the new drive. If ‘<exist-drive>:’ is not specified, ‘<path>’ is treated as being on the current drive. In this case, you can also specify a relative path. [Windows 95 or later?/NT series/XP or later] Instead of specifying a drive and path, you can also specify a network path. In this case, it is treated separately from the assignment of network drives. [MS-DOS, Windows 95/98/Me] It will fail if this directory is on a drive that has been ‘subst’ed (<exist-drive> is the ‘subst’ed drive, or if <exist-drive> is not specified, and the current drive is the ‘subst’ed drive). [Windows NT series?] It will also succeed if this directory is on a ‘subst’ed drive (let's call it X), and the new drive (let's call it Y) will be created. However, if the ‘subst’ for the drive X is removed, the ‘subst’ for the new drive Y will not be removed, but it will become an inaccessible, invalid drive. |
/D | Removes the assignment for <drive-letter>. After this, access to the drive with <drive-letter> will no longer be possible. |
Details
This program sets an existing directory as a new drive, allowing access to that drive. As this drive is configured at the OS level, it can be used not only in the command prompt but also by other programs like Explorer. If a directory name is long, you can use Subst to shorten the path.
However, drives assigned with Subst are purely virtual, meaning that certain operations available to a physical drive may be unavailable. Even if available, executing operations like Format is not advisable.
[MS-DOS] MS-When booting Windows from DOS, it is not possible to use Subst from within Windows.
Note that all Subst assignments are lost upon restarting the computer. If you want to use the same assignments every time, you need to register them in AUTOEXEC.BAT, Startup, or similar.
[Windows 95 or later?/NT series/XP or later] When assigning a shared folder on the network with Subst, the resulting drive does not become a network drive. To assign it as a network drive, you should use the Net command. ([Windows NT series] [Extensions] This behavior differs from the behavior of Pushd when extensions are enabled.)
* If authentication is required to access the specified network path, you need to authenticate in advance using commands like Net if necessary.
Samples
Sample 1
subst W: D:\MyDir\Files\work
Assigns a ‘W drive’ with the root directory set to the ‘D:\MyDir\Files\work’ directory. Subsequently, access to, for example, ‘W:\sheet.xls’ will be treated the same as access to ‘D:\MyDir\Files\work\sheet.xls’.
Sample 2
subst W: /D
If an assignment similar to the one in Sample 1 is in place, it deletes the W drive. Note that deleting the drive does not result in the loss of the directory used for the assignment and its contents (in the case of Sample 1, the ‘D:\MyDir\Files\work’ directory and its contents).
Sample 3
subst W: \\fileserver\project1\backup
[Windows 95 or later?/NT series/XP or later] Creates a W drive with the root directory set to the ‘backup’ folder within the shared folder ‘project1’ on the ‘fileserver’ computer on the network.