From command prompt with Administrator privilages:

c:\>mklink /h c:\dirA c:\Users\Piotr\dirB
Access is denied.

I'm on Vista x64. Using /j or /d instead of /h works. What's the problem?


Access is denied error, when I mklink on Windows 7.

  • Not sure if this is what you're after, but I tried mklink w/o any flags to try to link a directory and it didn't give me what I wanted. I tried using the \D flag and that seemed to work (not sure if that's different than \d or the default, which some ms docs said was 'symbolic'). – jinglesthula Jul 2 '14 at 16:12

Hard links can only be used for files, not directories.

References: MSDN: Hard Links and Junctions, <1>, and <2>

| improve this answer | |
  • I did create a hard link for a folder once before. i guess it wasn't hard link it was a /d . it will do the exact for me. – M at May 27 '16 at 12:22
  • 7
    "Access is denied."... Not the most helpful error message here. – P-Gn Jun 11 '18 at 16:44

You can use the /j switch to create a directory soft link. Be careful with the del command. To remove link to directory use the rmdir command, as del will delete all files in the directory the link points to.

| improve this answer | |

As far as I know hard links are allowed for files only, not directories. http://technet.microsoft.com/en-us/library/cc753194(WS.10).aspx

| improve this answer | |

I had the same issue: check that the file or folder that you are trying to create doesn't already exist (c:\dirA).

| improve this answer | |
  • 1
    Folder c:\dirA does not exist. – Piotr Dobrogost Apr 8 '11 at 21:15
  • OK, in this case, it's probably because it's being created on the root of c:\, see if creating it in another directory helps? – David d C e Freitas Apr 9 '11 at 7:19
  • 1
    I see nothing special about c:\ in this case. – Piotr Dobrogost Apr 9 '11 at 13:50
  • Permissions on the root of the drive (C:) are slightly different to normal user folders, as it's a sort of "system" area in windows. – David d C e Freitas Mar 19 '17 at 17:58
  • @fnt Oh, because it's two different possible reasons or fixes for the issue. One more popular than the other. – David d C e Freitas Mar 23 '17 at 20:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.