Create Virtual Drive for a folder using cmd

Virtual Drive is a Substitution to the actual drive or a folder in a drive.

Virtual Drive is an exact copy of the specified location, and it is always synchronized with the original location i.e., that any change will reflect in both locations.
Virtual Drive can be created as per your requirement, either you want to create a replica of a drive or for a specific folder on some drive.

Command SUBST is the way to achieve this. Microsoft Documentation.

Just open Command Prompt and type :

subst drive_letter: path_to_the_folder

here letter is the Virtual Drive letter you want to be.
and the path is the path to the folder or drive whose Virtual Drive is being created.
For example, if you want to create a virtual drive letter X: for a folder “D:\Multimedia\Videos”, then use the following command:

subst X: D:\Multimedia\Videos

Screenshot of cmd showing creating Subst drive

If you have already created a Virtual Drive and you want to delete it,
It can be done with the “susbst” command.

subst X: /d

/d” is for deleting.

You can view a list of all existing virtual drives by subst command without any parameter in Command Prompt.

Snapshot showing delete subst drive

Here are few things to keep in mind while creating the subst drives:

  • You cannot use existing drive letters for creating virtual drives. 
  • If your folder path contains spaces, put the whole path in quotes (‘ ‘ or ” “).
  • You should not be using chkdsk, diskcomp, diskcopy, format, label, and recover commands on these virtual drives as these are not physical drives and these commands may not work or might create problems for the actual drives.