2

I'm trying to find the equivalent of *nix symlink on windows, and started using mklink. The issue is that, as a normal user (not admin), I can link to a folder with the "/J" option, but I cannot link to a file. I managed to do it as administrator, but I need it as standard user.

Why only Administrators can create file links on Windows? Is there a workaround?

Fred Simon
  • 567
  • 3
  • 10
  • By the way, always prefer `mklink /D` over `mklink /J`. Windows explorer will delete the entire contents of a junction (the latter) whereas when deleting a directory link (the former) it will just remove the link. – Lawrence Dol Feb 09 '13 at 01:56
  • @SoftwareMonkey This is not so in Windows 7. Only the link is removed. (I tested it.) – Davor Josipovic Apr 09 '13 at 09:03
  • @Davor: You're right; was definitely the case in XP, but then XP didn't really "know" about junctions in the O/S - I used the SysInternals junction.exe to create NTFS junctions. – Lawrence Dol Apr 09 '13 at 11:56

2 Answers2

6

You need the SeCreateSymbolicLinkPrivilege to create a symbolic link, which I don't think users get by default.

-scott

snoone
  • 5,409
  • 18
  • 19
  • 3
    Thanks that helped. From the info I found based on this I compiled this text: "Creating symlink on Windows Vista and Windows 7 don't require administrator privilege per se, but SeCreateSymbolicLinkPrivilege. There are 2 ways to give this privileges to users: 1) Start gpedit.msc, go down to "Windows Settings"->"Security Settings"->"Local Policies"->"User Rights Assignment", then find "Create symbolic links" and add whatever users and groups you want. 2) If you have cygwin running: "editrights -a SeCreateSymbolicLinkPrivilege -a user" should work." – Fred Simon Jul 27 '11 at 00:28
  • I tried to add this privileges to myself, and everyone but still get: C:\Users\freds>mklink test-6.txt test.txt You do not have sufficient privilege to perform this operation. (And it works great as administrator...) – Fred Simon Jul 27 '11 at 15:28
  • 1
    Note: You need to log off and back on for the privilege to take effect. – Lawrence Dol Feb 09 '13 at 01:54
  • Where I can find SeCreateSymbolicLinkPrivilege? Where "Windows Settings"? – Kirby Aug 19 '15 at 05:29
1

Had problems creating links on Windows 10 Home Edition - I was getting "You do not have sufficient privilege to perform this operation". In the end, I was able to create a soft link using power shell with this command:

   cmd /c mklink /J c:\path\to\symlink d:\target\directory

The above creates a soft link but does not work for symbolic links (/D option). Soft link was sufficient for my needs (and I didn't have to install gpedit.msc).

Lidia
  • 2,005
  • 5
  • 25
  • 32