Windows – Create Symlink in Windows from command line without “.lnk”

symbolic-linkwindows

I want to mount a network share on a folder in Windows, because I have an application that's stored big files in a hard-coded path (e.g. c:\path\of\directory). I can't change that path.

This is easily achievable in Linux using softlink or directly mounting on that directory, but I don't know how it can be done in Windows. I have tried mklink.exe and subst, but it creates a folder like shortcut with a .lnk extension.

Can anyone help me?

Best Answer

Mounting a network share in an arbitrary directory path is possible with symbolic directory links, or by using DFS (Distributed File System) which is only available in Windows Server. See http://support.microsoft.com/kb/205524 (section "Feature Comparison to DFS").

To create a symbolic directory link use mklink /d c:\path\of\directory \\network\share (where directory must not exist in c:\path\of). Verify the command with dir /aL c:\path\of. If you ever want to delete the link be sure to use rmdir c:\path\of\directory and not del c:\path\of\directory which will delete files within that directory.

The symbolic directory link is not the same as an LNK-link. Even though it appears to be an LNK-link when viewed in the File Explorer, as it uses the same icon overlay with an arrow coming around the folder icon.

Another option, if you are in need of more storage space in that specific path, is to add another drive and mount that directly into the directory path. See http://support.microsoft.com/kb/307889/en-us for how to do that.

Related Question