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'). Jul 2, 2014 at 16:12

3 Answers 3


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

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

  • 11
    "Access is denied."... Not the most helpful error message here.
    – P-Gn
    Jun 11, 2018 at 16:44
  • @P-Gn Just the usual Windows error message...
    – inf3rno
    Oct 11, 2021 at 11:07

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.


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

  • 1
    Folder c:\dirA does not exist. Apr 8, 2011 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? Apr 9, 2011 at 7:19
  • 1
    I see nothing special about c:\ in this case. Apr 9, 2011 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. Mar 19, 2017 at 17:58
  • 1
    @DaviddCeFreitas No, it is not. There is no such thing as a hard link to a directory. There is no fix for "Access Denied" message when /h switch is used. The access permissions has nothing to do with this.
    – ᄂ ᄀ
    Mar 23, 2017 at 22:39

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.