Why can't I make a symbolic link (mklink) even when I'm an administrator [duplicate]
When I run mklink /D "C:\Users\bwilliams\AppData\Roaming\Sublime Text 2" "C:\Users\bwilliams\Dropbox\Sublime Text"
, I get this error `You do not have sufficient privilege to perform this operation.
Why not? I'm administrator, and just want to create a link in my own Users\bwilliams directory to another folder in my Users\bwilliams directory? What am I doing wrong here?
Thanks.
Solution 1:
You need to run mklink
from an elevated shell (Right-click the Command Prompt shortcut, Run As Administrator).
If you are running mklink from an elevated shell, check the permissions on the directory and make sure there aren't any explicit Deny permissions set for the Administrators group.
Note: Make sure you're not trying to create a link where a directory containing files already exists, and are not accidentally creating a recursive set of links.
Solution 2:
I ran into the same problems:
At first I got this error: You do not have sufficient privilege to perform this operation
And after retrying using an elevated cmd, I ran mklink /D linkToDir C:\temp\otherLink
and received this error: Cannot create a file when that file already exists.
Turns out there was a (broken?) symlink there, marked as System:
attrib *
A S C:\temp\linkToDir
So FYI, check that there's not a Hidden (actually System) file using that name from a previously broken symlink creation.
That is what I wanted to highlight here.
Solution 3:
I ran into the same problem and just managed to get it working. I was trying to force itunes to backup on another (larger) drive (C is an SSD).
Say you want to go from c:\dir1\dirToRedirect
to d:\dirToRedirectTo
, then:
Make sure dirToRedirect
does not exist, because Windows is gonna create a link of the same name, which creates a naming conflict. So, delete dirToRedirect
, create dirToRedirectTo
, and run mklink /j "c:\dir1\dirToRedirect" "d:\dirToRedirectTo"