Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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
up vote 28 down vote accepted

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

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

share|improve this answer
+1 for links, Thanks! – MMeah Jul 2 '12 at 10:47
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. – Mahdi Rafatjah May 27 at 12:22

You can use the /j switch to create a directory hard 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.

share|improve this answer

As far as I know hard links are allowed for files only, not directories.

share|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).

share|improve this answer
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
I see nothing special about c:\ in this case. – Piotr Dobrogost Apr 9 '11 at 13:50

You must log in to answer this question.

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