4

I want to create symlink to a file using the command prompt on Windows 7. The file is located on E partition and i want the link to be on C partition. I tried this command: C:\>mklink /d c:\11.txt e:\Test\11.txt and it said that the symbolic link was created successfully but if i click on the link i get this error massage: 'The directory name is invalid'

What is the right way to create symlink for a file from different partition?

11

By using mklink /D you're telling it to create a directory symbolic link and D:\test\11.txt is not a directory. So if you try to access the directory C:\11.txt it will give you an error.

Just leave out the /D and it should work.

  • It worked. I didn't know i have to omit /d. I thought using parameters is mandatory. – peter7558 Nov 7 '16 at 13:41
  • 1
    If you're unsure run mklink /? Parameters that are in [ ] are optional. So the only required parameters are Link and Target. – Seth Nov 7 '16 at 13:43
3

As an alternative, I had been using an Administrator-owned Command Prompt for too long until being able to simple use the Explorer context menu to create links.

I believe I used this program to add a nice subgroup to that context menu: Link Shell Extension

This is what it looks like integrated into the Windows UI: File Explorer Right-Click Context Menu opened to show Link Shell Extensions in sub-menu

Hopeufully that should add some convenience to your process, and remove any potential errors.

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.