SUBST – command to easily from folder create virtual drive

It is possible to map a folder to a drive letter. This old DOS function does not change for a long time, and it is easy to manage. Windows added some new options, no to command itself, but to way how it can be used.

To map folder to virtual drive:

SUBST [driveletter:] [folderpath]

Example:

SUBST F: c:\temp

or

SUBST F: “c:\My Folder\My Subfolder”

If the path contains spaces, enclose the it in quotes.

To remove existing mapping:

SUBST [driveletter:] /D

Example

SUBST F: /D

To get a help:

SUBST /?

To see list of mapped drives/folders:

SUBST

Mapped drive letter will exists till Windows restarts or user log off/on. To make this mapping permanent should be done next:

  • if we wish to subst it on the level of machine:
    • Open regedit
    • Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
    • Right click
    • Run > New > String Value
    • Name it for example Subst_driveletter – this is descriptiv, not important
    • As value add dos command for mapping (SUBST [driveletter:] [folderpath])
    • After reboot, it will map new drive
  • if we wish to subst for particular user:
    • Open regedit
    • Go toHKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
    • Right click
    • Run > New > String Value
    • Name it for example Subst_driveletter – this is descriptiv, not important
    • As value add dos command for mapping (SUBST [driveletter:] [folderpath])
    • After reboot, it will map new drive