51

I am having an issue creating a symbolic link on Windows 7 Ultimate. I want to map a folder from a mapped network drive into My Documents.

mklink /D "C:\Users\Vegard\Documents\Virtual Machines" "Z:\Virtual Machines" returns You do not have sufficient privilege to perform this operation..

Z:\Virtual Machines is set to be available offline, but I am online when I am trying this.

This is what I've tried (as suggested here):

  1. Using Local Security Policy to add my user to Local Polices\User Rights Assignments\Create symbolic links, and rebooting. No luck.

  2. Running cmd.exe as an Administrator, but then I cannot see the mapped network drive at all. I can however create symbolic links on the drive.

  3. Using fsutil to change symlinkevaluation, to set R2L:1 (even though it seem to me I want L2R, which is already enabled).

  4. Using full UNC path of the shared folder does not work either (The syntax of the command is incorrect. when run as an administrator, You do not have sufficient privilege to perform this operation. when run as a normal user).

Output of fsutil behavior query symlinkevaluation:

C:\Windows\system32>fsutil behavior query symlinkevaluation
Local to local symbolic links are enabled.
Local to remote symbolic links are enabled.
Remote to local symbolic links are enabled.
Remote to remote symbolic links are disabled.

Any ideas?

1
  • As I mentioned below, this is because an elevated prompt does not have the foldershares mapped to it. Try a cd z:` and you'll get an error. run cmd` as a user and see that the folder is mapped.
    – surfasb
    Dec 23, 2011 at 23:04

7 Answers 7

73

Run cmd as administrator and use UNC path.

The following command worked for me as administrator:

mklink /D C:\temp11111 \\server\share\foldername\

And also check whether your command contains appropriate quotes (").

1
  • Just to save everyone else scrolling, this is a much better answer than the accepted answer.
    – Chris Rae
    Apr 15, 2022 at 5:37
11

This is a old thread, but still want to clarify that you can create symbolic links like this:

Your user account has some security policies on them by default which can be disabled, through secpol.msc. Go to the Run dialog and type:

secpol.msc
  • Navigate to: Local Policies > User Rights Assignment
  • Double click: Create Symbolic Links
  • Add your username to the list, click OK
  • Log off

When you log back in, run cmd with admin privileges. Now you should be able to run mklink commands like this with no problems:

mklink /d %userprofile%\music \\server\music

Note: Make sure the directory you're trying to link to exists or hasn't been moved or deleted, prior to linking.

2
  • 1
    Note; secpol.msc doesn't exist in the home version of win7.
    – JonoRR
    May 28, 2014 at 7:59
  • 1
    Why is running as administrator necessary? If the user has the Create Symbolic Link privilege, one would think no such elevation would be required
    – kreemoweet
    Sep 5, 2015 at 3:54
4

If you are doing this in Powershell, you'll need to open CMD first:

CMD /C MKLINK /D C:\local\path \\UNC\path\folder

The /C argument tells CMD to run the command in the string and then exit.

0

My solution became to disable User Account Control, reboot, then create the symlinks as my own user, then re-enabling UAC and rebooting again.

Rather unfortunate if I need to create further symlinks at a later stage, but it does work, it is just very inconvenient.

1
  • 7
    This is because the foldershare is mapped under the user account. When you launch cmd as admin, it launches as an admin account, and does not have the foldershares mapped.
    – surfasb
    Dec 23, 2011 at 23:03
0

You cannot do symbolic links in networks and mapped drive as source, you can only use it as target and the source is your local drives

you cannot do like this:

Mapped Drive is Drive Z:\ Target (Local drive or Network)

Mklink /d z:\SourceFolder c:\Target Mklink /d z:\SourceFolder F:\SharedNetworkFolder

they are error and cannot used as symbolic links

only from Local to network and Local to Local only will work in symbolic links

0

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

1
0

The answer below is doesn't exactly answer the question, but since I ended here after searching for my issue, I'll add my solution.

Somehow I always got the

The system cannot find the file specified.

when I tried to make a hardlink using mklink.

However, when I used fsutil hardlink it worked.

Note that the source and destination folders for mklink and fsutil hardlink are reversed!

You must log in to answer this question.

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