Mapping drive letters to local folders

Solution 1:

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

Solution 2:

Alternative:

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

The difference between net use & subst below break


subst

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 /?

Solution 3:

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

\DosDevices\C:\Folder\Example