Create a Virtual Drive for Your Desired Folder in My Computer Using Subst Command

Today we are going to tell you about a secret DOS command “subst” which can be used to create a virtual drive in Windows Explorer for any of your desired folder.

For example, if you frequently use a folder “E:\Wallpapers”, then you can create a virtual drive in Explorer which will directly go to this folder whenever you double click on it or access it from RUN or Command Prompt. It’ll save a lot of time.

Here is how to do it:

Advertisement

1. Open Command Prompt and provide following command:

subst drive_letter: folder_path

for example, if you want to create a virtual drive letter H: for a folder “E:\Wallpapers”, then use following command:

subst H: E:\Wallpapers

Creating_Virtual_Drive_using_subst_.jpg

2. It’ll immediately create a virtual drive H: which will represent the “Wallpapers” folder:

Before using subst command:

Advertisement

Default_Drives_in_My_Computer.jpg

After using subst command:

Virtual_Drive_in_My_Computer.jpg

3. As you can see. A new drive letter H: has been created which directly goes to “E:\Wallpapers” folder upon double-click.

4. If you want to delete this virtual drive, then provide following command:

subst drive_letter: /D

for example, we created H: drive in Step1, so our command to delete this virtual drive would be:

subst H: /D

Deleting_Virtual_Drive_using_subst_.jpg

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

NOTE:

A. Remember! You can’t use existing drive letters for creating virtual drives, e.g. if you have 2 partitions C: and D:, then you can’t use them for subst command.

B. If your folder path contains spaces, put the whole path in double-quotes (“”).

C. You should not use chkdsk, diskcomp, diskcopy, format, label and recover commands on virtual drives created using subst command as these virtual drives are not real and these commands either will not work or can cause problems for the actual drives where the folders reside.

Also check:

[AIO] Ultimate Tutorial to Customize My Computer Context Menu in Windows

Published in: Windows 7, Windows Vista, Windows XP

About the author: Vishal Gupta (also known as VG) has been awarded with Microsoft MVP (Most Valuable Professional) award. He holds Masters degree in Computer Applications (MCA). He has written several tech articles for popular newspapers and magazines and has also appeared in tech shows on various TV channels.

Comments

NOTE: Older comments have been removed to reduce database overhead.

  1. Nice one but easier to use apps like vsubst or visual subst which do the same but with no hassle )

  2. It is giving me the following error:
    Incorrect number of parameters – Menu\coolking
    when I Typed :
    C:\Users\Soni Srivastava>subst v: c:\C:\ProgramData\Microsoft\Windows\Start Menu\coolking

    Please help.
    thanks in advance.

  3. ^^ There are 2 C:\ in your command:

    C:\Users\Soni Srivastava>subst v: c:\C:\ProgramData\Microsoft\Windows\Start Menu\coolking

    Also enclose the folder path between double-quotes as your folder name contains spaces. The correct command would be:

    C:\Users\Soni Srivastava>subst v: “C:\ProgramData\Microsoft\Windows\Start Menu\coolking”

  4. There’s inconsistencies between your code above on the “How To” and the answer you provided to Cool King.

    The text shows: “E:\Wallpapers”
    But the image does not.

    You should recapture that image to show the quotations or it wont work at all and give him the error, Incorrect number of parameters.

    Good assistance though.

  5. Thanks for a very clear description of virtual drive creation. I have 7 Pro as Host, and XP as Guest. When I insert the following text into Command Prompt it works fine and sets up the S Virtual Drive: subst S: C:\MySharedFolder (spaces after subst and S:). However, when I shut down and restart the Host 7 Pro the Virtual Drive S no longer exists. I thought the answer was to start Command Prompt as Administrator, however instead of the usual C:\Users\PC> to be followed by my above text, of course I get C:\Windows\system32 and I don’t know the correct text to set up a Virtual Drive as Administrator…if it’s possible or if it would work anyway.
    All I really want to do is to keep the Virtual Drive on my 7 Host PC following shut down.
    Thanks, Regards, Mike

  6. Further to the above, I set up the subst,( not as admin), to create the Virtual Drive. Then as Administrator I just put C:\Windows\system32>subst This gave me the correct path as
    C:\Windows\system32>subst S:\: => C:\MySharedFolder. This is presumably correct as I get
    “Access Denied”……………..! Now what?
    Regards
    Mike

  7. Fixed Access Denied via UAC, set up Virtual Drive as Administrator, still disapears on restart.

  8. Mike, please see en.wikipedia.org/wiki/SUBST. You need to modify registry in order to keep drive after reboot

  9. That is not create a Virtual Drive, subst only creates a Virtual Mount Point, not a Virtual Drive.

    With Subst you can not make it to be seen on disk managment, neither partition it, etc.

    It is only about creating a Mount Point that points to a folder.

    If you can, please correct the title…. i can sugest you two titles (the first is the more technical correct, while the second is more human readable):

    Create a Virtual Mount Point for Your Desired Folder in My Computer Using Subst Command
    Map a Drive Letter for Your Desired Folder in My Computer Using Subst Command

  10. For all thoose… subst does not save nothing permanently.

    Command is: subst : “Full path to a folder”

    It will only make such letter to point to that folder, aka, create a temporal virtual mount point… so on next reboot it is lost.

    If want stay after reboots, you must:

    a) Type that command after each reboot
    b) Create a Batch and create a Shortcut to it on startup
    c) Define a schedule task.

    Choose the one you want (just only one, not all at the same time).

  11. Ugly forum… it deleted the “less than” and “greater than” symbols… i will try with another character pair…

    Command is: subst [Letter]: “Full path to a folder”

    See the double quotes… that is for allowing that path having spaces on it.

Leave a Comment

Your email address will not be published. Required fields are marked *

NOTE: Your comment may not appear immediately. It'll become visible once we approve it.