Using mklink command with network drives
Asked Answered
U

3

18

I have two network drives that I access through Windows 7: V:\ and T:\ I am trying to create shortcuts between the two that alphabetise with folders (rather than files), so I am using the mklink command:

mklink /d \Photos V:\Photos

which creates a symlink at C:\.

I can move the symlink around locally. However, when I try to move the symlink to a network location, it begins copy the actual files over rather than symlinking them.

I figure that if I can create a symlink of a network drive on a local drive, what's stopping me creating a symlink of a network drive on another network drive. Am I correct in assuming this?

Is there any way to designate the destination file path when creating symlinks with the mklink command? Or is there any way to move symlinks to a network drive at all?

Unbalance answered 6/2, 2014 at 23:38 Comment(0)
P
22

If you need to make a directory junction (using /J) on a network drive, you can first creation a directory (/D) symbolic link and then create a junction off of that, like so:

mklink /D D:\shareLink \\network\share
mklink /J D:\junctionLink D:\shareLink
Photoelectric answered 29/9, 2017 at 14:46 Comment(2)
Thank you, that worked form me to move iTunes backup to a mapped drive! The only thing you need to do is to rename the "backup" directory in the AppData to something else, otherwise it won't work.Tropine
Doesn't appear to be working on Windows 10. I get "The file cannot be accessed by the system."Percent
L
8

You need to enable local to remote links by running this command with elevated rights:

fsutil behavior set SymlinkEvaluation L2R:1

Also you can enable this with your local or group policy: Computer\System\Filesystem\Selectively allow the evaluation of a symbolic link --> allow local to remote

Laurilaurianne answered 8/7, 2016 at 13:14 Comment(0)
G
2

You will need to log onto the computer hosting the network drive and run the mklink command from there.

I recommend creating a junction /J instead of a symlinkd /D. Symlinks have some additional settings you need to be aware of. See symbolic-link-cannot-be-followed.

Galateah answered 22/4, 2014 at 6:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.