Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Does Windows (XP or later) have a built-in way to create persitent drive mappings, like the ones SUBST creates? I found a 3rd party tool psubst. Is there a way to do it without 3rd party tools?

share|improve this question
Probably not else the program wouldn't be needed... –  Ivo Flipse Aug 24 '09 at 22:58
It is possible, because psubst is just a .bat file that mucks with the registry. See @davr's answer below for details. –  Scott Stafford Jan 29 at 15:13

6 Answers 6

up vote 71 down vote accepted

Well Wikipedia mentions:

C:\>SUBST /?
Associates a path with a drive letter.

SUBST [drive1: [drive2:]path]
SUBST drive1: /D

  drive1:        Specifies a virtual drive to which you want to assign a path.
  [drive2:]path  Specifies a physical drive and path you want to assign to
                 a virtual drive.
  /D             Deletes a substituted (virtual) drive.

Type SUBST with no parameters to display a list of current virtual drives.

So you can associate paths with drive letters using subst. The Persistent SUBST command (psubst) software seems to be darn handy, and they provide a solution to run it from startup:



However restart of a system destroys a virtual disk. What to do? A disk can be created after startup. But what to do, when a disk is needed on early steps of a startup? For example, to run services? There is system feature to start a virtual disk from the system registry:


[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices] 
"Z:"="\\??\\C:\\Documents and Settings\\All Users\\Shared Documents"

It is enough to create a text file with the extension .REG and run it. When the next starting up of a system, the virtual disk will be exist at logon. It needs to define a name of disk and path. Note that each backslash in the path is doubled.

In Windows, you can run the registry editor as follows:

  1. Start » Run... (or hit Win+R)
  2. Type: regedit
  3. In Windows Vista and above, UAC will pop up, click "Yes".
share|improve this answer
Nice to know, even though I don't use subst anymore. But back in the times when I did I used to simply have a batch file sitting in my Startup folder which did those things. –  Joey Aug 25 '09 at 8:46
This is awesome. (It requires a reboot, FYI.) Our source tree has to start from a specific drive letter so that our PDBs all always align on different computers. This registry setting solves an annoyance that I have had for years with a subst disk not being there with runas which is a big annoyance if you need to (rarely) run Visual Studio under an admin account. –  Brian Reiter Sep 23 '09 at 18:58
Glad to be of a help ;-) –  Ivo Flipse Sep 23 '09 at 19:42
Joey: That solution doesn't seem to work under Windows 7. When running an application with Administrative privileges, the substituted drive is not visible to the application. –  Dave Jarvis Jul 29 '12 at 19:06
Thanks for the solution. FYI, if you type the variable into RegEdit interactively, do not double the backslashes. That is, create a new string variable named "Z:" (without the quotes) and set the value to the string shown above except with single backslashes. –  Crispy Aug 21 '12 at 20:58

Installing it at HKEY_CURRENT_USER has the benefit of having different setups for each user. I prefer to stick the user space setup as long as a system service dose not depend on the device.

"F Drive"="subst F: D:\\mount\\db"
"G Drive"="subst G: D:\\mount\\log"

Source: http://networkadminkb.com/KB/a446/how-to-use-drive-letters-mount-points-the-same-disk-drive.aspx

share|improve this answer
+1 For showing how to do multiple mappings in one reg file. :-) –  daiscog May 15 '12 at 15:37
+1 for the ease of this & also explaining why HKEY_CURRENT_USER. :) –  CAD bloke Feb 18 '13 at 8:19

I found this because I was looking for an improvement over my startup subst scripts - they worked OK, but sometimes executed after folders crashed on startup because my drive wasn't yet mapped.

First, I edited the registry, but was unable to get it to work. However, I did come across this alternative, which although it doesn't use subst does answer for me the question, "How to make SUBST mapping persistent across reboots?" Don't use subst... (insert appropriate 'computerName' and 'pathName'):

net use u: "\\computerName\c$\pathName" /persistent:yes

I adapted this from Hank Arnold's suggestion at this discussion of mapping local drives. I had guessed that \\myComputerName\c might work, but I didn't know to apply the $.

Before you try the "net use" command, try to navigate to

to make sure you have 'computerName' correct.

share|improve this answer
Excellent solution, albeit with two problems: 1) it's not visible to the local file-system, 2) permissions... –  ashes999 Oct 11 '11 at 15:41
if you use \\localhost\c$\path\to\thing it is portable across machines (or upgrades that change the computer name). A drawback of using a mapped drive on Win7+ is that different security policies apply to network drives than local, and some programs will just refuse to run off a mapped drive. –  matt wilkie May 28 '13 at 6:55
It is visible to the file system, and it is visible to the local file system -- it's marked as a network drive, just as some drives are marked as removeable drives. That doesn't make such drives not a part of, or not visible to, the local file system -- it makes them network/removable drives in the local file system. –  user165568 Jan 2 at 9:35

Actually, the PSUBST tool joins two different ways of creation of substituted drives in Windows. If you want to have persistent drives between startups then you can run this tool once per each drive that you need. Another way is to use the method suggested by "davr". the PSUBST tool just makes the same but allows to make it in the easier way.

share|improve this answer

Did you even read the page you linked to? You don't need the third party tool, you can do it with a simple registry entry, as detailed on that page.

Create a text file named 'mapdrive.reg' with these contents:


[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices] 
"Z:"="\\??\\C:\\Documents and Settings\\All Users\\Shared Documents"

Then should just be able to double-click on it to set up, no 3rd party tools needed.

share|improve this answer
the advantage to the reg key versus the batch file is that it sets the subst drive before any other startup commands run, in case some of those need the subst drive to function –  davr Aug 24 '09 at 23:37
@Ivo: I'd call it a healthy fear of the unknown ;) –  Isxek Aug 24 '09 at 23:55

Drop a batch file in your Startup folder that does all the SUBSTs that you want to do.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.