How to create symbolic link in windows 7

June 2nd, 2009

You are currently browsing comments. If you would like to return to the full story, you can read the full entry here: “How to create symbolic link in windows 7”.

Related Posts:

25 Responses to “How to create symbolic link in windows 7”

  1. Don Williams says:

    What is the difference between:
    1. directory symbolic link
    2. symbolic link
    3. hard link
    4. directory junction

  2. Don Williams says:

    What is the difference between:
    1. directory symbolic link
    2. symbolic link
    3. hard link
    4. directory junction

  3. Tom says:

    There is a little utility I discovered for creating sybolic directory links in Windows 7 that works great

    dirlinker.codeplex.com

  4. David Lawrence says:

    Thank you tom for the utility. I could not actually get the command to work strangely enough, but that utility did just what I needed it to do, thank you very much again :) .

  5. gargamel says:

    @Don Williams
    Hello, my answer can not be 100% exactly but I guess:

    1. directory symbolic link – creates a folder symbolic link(if you don’t specify \D \J …by default it creates a file )
    2. symbolic link ( maybe a file and not folder…not sure)
    3. hard link(no ideea)
    4. directory junction
    C:\WEB\xampp\htdocs>mklink /J C:\WEB\xampp\htdocs\Test “E:\work\Test”
    Junction created for C:\WEB\xampp\htdocs\Test <> E:\work\Test

    A folder named Test will be created at C:\WEB\xampp\htdocs and this folder(Test) will point to the folder
    E:\work\Test

    Junction = if you modify something in C:\WEB\xampp\htdocs\Test the changes will also occur in E:\work\Test and viceversa

    if you would have used /D instead of /J like in my example you would have created a directory symbolic link. In this case ONLY changes in E:\work\Test will occur in C:\WEB\xampp\htdocs\Test, but if you modify something in C:\WEB\xampp\htdocs\Test this will not modify the contents from E:\work\Test.
    Hope this helps.

  6. Bryan says:

    @gargamel you’re answers aren’t quite right.

    1. This is right
    2. Symbolic link, this is just a “virtual” file or directory. From the view of the user it creates what appears to be another file, but this just referencing the hard location under the hood in the file system. e.g. If you have C:\mytext.txt and a symbolic link c:\users\user\readthis.txt. Clicking it would open the mytext.txt and any changes would be to mytext.txt regardless of which file was opened. However, deleting the readthis.txt will not delete the mytext.txt file.
    3. Hard link this creates and actual link to the file. So things would appear the same as above, but if you delete readthis.txt it will also delete mytext.txt
    4. This is much like a symbolic link with the /D flag, the difference is just a technical feature of NTFS and how the information is stored. The /J flag will not allow you to network locations.

    Hopefully that clears things up a little.

  7. roger says:

    How does one tell easily if a specific file is a soft link or not?

  8. green man! says:

    you are crazy!!!

  9. fijOsh says:

    Actually I believe that the syntax is incorrectly defined by Microsoft.

    When I tried to create a directory symlink using:
    mklink /D D:\Users\Jirka\Test Test
    I got an error message that I cannot create file that already exists.

    When I switched the new symlink name and target directory, it worked just fine:
    mklink /D Test D:\Users\Jirka\Test
    symbolic link created for Test <> D:\Users\Jirka\Test

    So there’s no need for using any 3rd party tools to create links, just specify the new symlink name as a target and vice versa and voila! :)

  10. fijOsh says:

    Oh, my bad, I did not read the initial post very thoroughly.. Now I can see that in English version has it correct – it is my (Czech) localization that is apparently not so flawless.. :) The Link and Target parameters are switched in the man page..

  11. Bryan your’re not quite right too:
    3. Hard link this creates and actual link to the file. So things would appear the same as above, but if you delete mytext.txt (original file), the file readthis.txt will still be accessible and will contain all content of file mytext.txt. Actual file data will be removed only when there is no hard link of that file left.

    More on hard links: http://en.wikipedia.org/wiki/Hard_link

  12. StefanNch says:

    Works!.. Thank you!

  13. Luis H says:

    Is it possible to remove hard link by command line? How?

    Tks for any help.

  14. Luis H says:

    I’ve found how!

    supose c:\file d:\file

    (d:\file is a link from c:\file)

    the command are one of these:

    del d:\file (if it’s a file link)

    rmdir d:\file (if it’s a dir link)

    cheers!

  15. jim L says:

    Is there a way to make a symbolic link WITHOUT admin access?

  16. izle says:

    hello
    Is it possible to remove hard link by command line? How?

    thanks

  17. myles says:

    This is to TOM for recommending dirlinker! THANK YOU!! I’ve done this awhile ago the hard way… and now I need to do it again but forgot how so I had to research it and I found this forum!

  18. [...] is running Win7 and one that is still XP. Windows 7/Vista supports the creation of symbolic links natively. We can create this by going into an administrative command prompt (go to start menu and type cmd [...]

  19. [...] each folder, create a symbolic link from your original location to the new one inside your Dropbox by running mklink from an [...]

  20. Sarlacc says:

    Thanks!

  21. Great work! That is the type of info that should be shared around the web. Disgrace on Google for no longer positioning this submit higher! Come on over and discuss with my site . Thank you =)

  22. Dave says:

    My understanding of the difference between ‘hard’ vs ‘symbolic’ links comes from the Unix world and is as follows:

    Hard links are like pointers in C/C++. However, instead of pointing to an address in memory, they point to a sector on disk. Because of this, a hard link can only point to a sector within its’ own partition.

    A symbolic link is basically a string. It holds a name where the file/folder resides. Because of this it can point to anywhere the PC has access to, including files on networked computers.

    Hope that helps.

Leave a Reply