My home directory is c:\Users\phi as a user phi, and I made a directory at c:\Users\abc. I need to symbolic link from c:\Users\phi\hello to c:\Users\abc\hello.

I run the following command

mklink c:\Users\abc\hello c:\Users\phi\hello

But I get the Access is denied error. User phi is Administrator, so I have no problem writing files in c:\Users\abc.

Why is this? How to mklink?

link|improve this question

74% accept rate
feedback

6 Answers

Note that the same error will be presented when you try to create junctions on mapped drives. I was pulling my hair out on this until I came across the examples on this page on MSDN Hard Links and Junctions.

Short answer: you can only use mklink on local volumes.

link|improve this answer
feedback
up vote 2 down vote accepted

I found answer at this site. In short, I should have run cmd.exe as Administrator.

link|improve this answer
feedback

I was getting this because I accidentally ran mklink /D against a file. The link wasn't showing in explorer but it did in Windows Explorer. Using the Command Prompt I deleted the original invalid directory link and then recreated it without the /D option.

By the way, I was getting the "Access is denied" error even though I was running cmd.exe as an administrator.

link|improve this answer
feedback

Apart from running mklink as Administrator you also should make sure that you have enough permissions to the destination folder you are linking to.

link|improve this answer
feedback

This might sound weird, but check that the file or folder doesn't already exist that you are trying to create. Sometimes it's easy to overlook in the cmd prompt.

link|improve this answer
feedback

For directories you have to do:

mklink /D c:\Users\abc\hello c:\Users\phi\hello
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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