There are at least three solutions, how to map drive letter or directory to a local folder, available in Windows. All are discussed in this article along with some side problems and examples on how each solution can be used.
Map drive to a directory
subst command has been around since the early days of DOS. So it’s quite famous and widely used. It is also simple in use. Run command line (
cmd) and type following:
subst F: D:\Photos
Now, you have an
F: drive that points to a contents of your
Disadvantages? Your newly created drive will have label the same as source drive (D: in this example) and you can’t change it. Depending on version of the system, you’re using, either you’ll see “Invalid label” error message after any attempt of changing substituted drive or you’ll change source drive label as well. This new drive will also have disk size and free space the same as source one, which might be confusing at some point.
If you are OK with that, then paste above command to
C:\autoexec.bat (create one using Notepad, if you’re missing this file) to have your subst’ed drives ready on each system startup.
subst F: /D
to remove any subst’ed drives or:
to get more options of this command, but there aren’t much that I missed! :]
There are some rumors, that you can achieve exactly the same by simply using Map Network Drive and browsing to a local folder instead of network path. I can’t confirm that, at least on my Windows 7. I see message saying that
D:\Photos folder is not available.
These are called symlinks or symbolic links. This is something that Linux has from the very, very beginning and what is so obvious for Linuks users like the fact, that sun rises. While Microsoft required years and years to provide Windows users with this useful command.
You can use
mklink command for this purpouse. For example:
mklink /D C:\Photos D:\Documents\Photos\My
You should see a message confirming creation of a symlink. When you browse to the symlink, you’ve just created, you’ll see that it has a normal folder icon, with shortcut overlay (normally used for file shortcuts) over it. This is fixed and you can’t change it (
Change icon option is disabled in
You can provide both local folder or network path. The second approach seems to be more useful, as you can make high-level folder (symlink) pointing to deep-level network structure:
mklink /D C:\NewTrendsCorp \\ThunderServer\Customers\Current\Premium\New\Trends\Corp
If symlinked network path is unavailable, you’ll see a proper message. But, suprisingly (or not?) Windows will claim that “C:NewTrendsCorp” (in this example), not real network path, is unavailable, which again might be a little bit confusing.
mklink does not checks, if destination exists. You can provide both unavailable network path or non-existing drive letter, folder structure etc.
As in Linux, if you delete a symlink, you’re of course deleting only link, not the destination folder and it’s contents. Even, if you use command line:
and confirm it, contents of symlinked folder will not be removed, though Windows claims something different.
mklink to see other options, you can use with this command. Notice, that it does not provide parameter for deleting symlinks. You have to delete them manually, from Windows interface, using some third party software or via command line:
More experienced solutions
You can link a directory to another directory on the same or another disk, link a partition to a directory, link network path to a folder etc.
If you have lots of drives, then you can use Disk Manager under
Administrative Tools > Computer Management > Disk Management to remove drive letters from the additional disks and to connect them to empty folders on the primary disk. This way, you can create a single directory structure — i.e. pin additional drives to a folders in C: disk and have only one partition (disk) C: with other partitions “hidden” inside this one.
This article is based on following /source — on both main article and comments. Plus I have added my own knowledge.