How to make an old school SUBST virtual drive persistent

If you have touched DOS before, you might still remember what this old school command subst is all about. It’s a command used for substituting local paths on physical and logical drives, known as virtual drives. For example, if you want to have a logical drive P: mapped to a local folder on your computer, say c:\temp, you can simply use the following command to make it.

subst p: c:\temp

It’s very useful when you test out the application that uses a network mapped drive so you can have a complete test environment right on your local machine.

However, any subst’d virtual drivers are not persistent. You have to Subst them again once the computer is rebooted. Making a batch file that includes subst commands in it and placing it in startup folder doesn’t seem to be working for something.

If you want to make them like a permanent driver that doesn’t disappear, you can either

Create a new registry entry “string value” in the following key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices

The name of the entry should be “X:” where X is the drive letter you want to make.

And the value of the entry should be the local path in the form of: \??\c:\path. Make sure reboot once to make the change take effect.

Or, if you are not comfortable with playing around the registry keys, you can also use a tool called psubst with an option /p as well.

10 thoughts on “How to make an old school SUBST virtual drive persistent

  1. Awesome… You learn something every day (and all that).

    I’ve only been using subst since MS-DOS 3.x days but hadn’t heard of this.

    Any idea what version of Windows did it appear in? sigh… It’s probably been around since like Win95…LOL

    Anyway, thanks for posting this,
    Greg

  2. Thanks for the registry tip. I’m just updating from a W2K computer to a Windows 7 box, and the differences are kicking my ass. My primary app needed a subst drive to work properly, but running a subst in the startup folder wouldn’t work properly. I could see the subst at a command prompt, but W7 didn’t show it, and therefore my app couldn’t see it. Putting it in the registry “magically” allowed W7 and my app to see it, and consequently work. THANKS!

  3. Thank you very much, Kent. An excellent tip! I have lost a lot of time trying to adapt Windows 7 Professional 64 bit system to previous systems running XP Pro and using subst drives D: and E: on sub-folders of C: . In XP they could be simply created by placing batch file with assign drive: path commands in Startup folder. The only problem with this setup in W-XP was that USB flash drives were assigned the same letters. However that problem could be excellently solved by free USB DLM drivers from Uwe Sieber. (I use them on W7 too).
    However, this assignment does not work reliably In WIndows 7, neither in startup folder nor placing the script command in the usual HKLM\Software\Microsoft\Windows\CurrrentVersion\Run registry entry.
    First checks show that Kents’ tip works very well on W7, including the correct USB drive assignment (D: and E: are not reassigned when adding USB flash drive. However, I have USDLM service running and do not know how it looks like without it ).

  4. The registry key worked like a charm on the Windows 7 SP1 64 bits machine of my colleague, who needed an extra drive letter and asked me for assistance.

    Thanks a lot, man!

    P.S. Could you please add a sentence to the article saying something like “The reboot is required to apply the changes and mount your new drive letter”. I figured it out myself, and I think the article really needs that information. Thanks in advance!

  5. Pingback: company office
  6. If only one user i using the machine this works.
    On a per user basis, say if the machine is shared, you can add a script with the requisite subst command to the Windows startup folder.
    On windows 8.1 you can open the startup folder with Windows-R shell:startup or else just type shell:startup in the address of windows explorer. Then
    in that folder create the script with the necessary subst commands.

Leave a Reply

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