Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a windows equivalent to the old dos SUBST command?

I want to be able to assign a local drive letter to a folder on a local drive.

I realize that a mapped drive will work (and so far that's the technique I've ended up using), but it doesn't seem to cut-in until rather late in the boot process. I've also in the past tried putting SUBST commands in batch files in the boot process, but that doesn't seem to work either.

share|improve this question
up vote 59 down vote accepted

Good news! The subst command still works in Windows 7!

To create a new mapping:

subst x: C:\Folder\Example

To remove a mapping:

subst x: /D

share|improve this answer
Yes, I know it works, but I couldn't get it to happen automagically on boot (especially as early as possible). Do you know how that can be done? – PaoloFCantoni Sep 13 '13 at 4:47
Have you tried making a batch file out of the above command and adding that as a startup script in gpedit.msc/Local Group Policy Editor? – Josh Sep 13 '13 at 4:54
Have now... I don't think I tracked that down (not being a sysadmin) when I tried it before. Seems to be the place to do it... However, using @50-3's point I may use NET USE in place of SUBST. – PaoloFCantoni Sep 13 '13 at 5:46
Caution! SUBST is practically unusable on a multi-user setup (even if only one real user + an admin). Since a SUBST mapping is user-local, other users won't see it! E.g. you click "Run as administrator" on a shortcut that points to a SUBST-ed place, and it will fail to run. – Sz. Oct 3 '15 at 22:51
@PaoloFCantoni, Here: How to make SUBST mapping persistent across reboots? .. – Pacerier Jan 15 at 19:20


net use x: \\localhost\c$\Folder\Example

The difference between net use & subst below break


When a share becomes unavailable subst will try over and over again to re-connect severely impacting performance of your PC as it tries to re-connect. This is less common when mapping local files as it will only occur if you say re-name the folders in the path. The resolution if this does occur is subst x: /d

net use

net use was introduced in win2k/xp to provide an alternative to this. When net use is used to connect to a location and that location becomes unreachable windows will report drive as disconnected and not try to re-connect until user tries to re-connect to resources on the mapped drive. This resolves the performance issues noted in subst

For more information on both commands you can query via the command line with /?

net use /? & subst /?

share|improve this answer
Normally, since the drive I want to map to is local, I'd use SUBST. However, since it's a USB connected local drive and not always available, will it trigger the problem outlined above? – PaoloFCantoni Sep 13 '13 at 5:19
Why yes it would - however I'm not sure how you would correctly address it as a USB might not be assigned the same drive letter every time it's plugged in – 50-3 Sep 13 '13 at 5:21
Good thinking, but as it happens, I'm intending to use it on an ASUS TX300CA Windows 8 transformer tablet which has a detachable keyboard dock On the tablet part there are NO USB ports, so the BIOS must assign the keyboard dock drives (which are USB) before anything else. So they shoudl be stable. I'm sure ASUS would have sorted that. – PaoloFCantoni Sep 13 '13 at 5:45
At least you should now have a good grasp on your options. Do us a favor and upvote @Josh his answer was high quality and answered your original questionp perfectly – 50-3 Sep 13 '13 at 5:58
Besides the retry functionality, is there a difference in performance between the two methods? The net use approach seems preferable but if there is significantly more overhead because it gets the network stack involved I'll use subst since I'm not likely to run into the retrying issue. – Jay Paroline Jul 24 '15 at 15:23

The best way to do this across bootup is to put it in the registry. Open regedit.exe and navigate to

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

Add a new REG_SZ value and name it X: where X is your drive letter

The value should be the path in this form

share|improve this answer

Another way is to put a share on the folder you want to map. You can then use the map network drive option which can be accessed by right clicking on my computer in windows explorer.

Note you will need to turn on network discovery before setting up the share.

The advantage of this approach is you set the option of create on logon.

share|improve this answer

Just to add to the answers above. Another option is a symbolic link which is covered in this SU question How to mount a network drive to a folder?

share|improve this answer

The best way is through drive management. You can specify a path to mount a drive to rather than a drive letter.

Go to Control Panel -> Admin Tools -> Computer Managment -> Drive Management.

Right click on the volume you want to change, and select Change Drive Letter and Paths.

This way, you can remove the original drive letter all together, and have it mounted under a directory only. This is how you can get around the 24 drive limit in windows.

share|improve this answer
This only lets you create logical driver letter mappings to partitions. It does not allow you to create a logical drive letter mapping to a folder/path/directory, so it doesn't address TC/OP's needs. – DevNull Nov 18 '15 at 21:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .