How to create symbolic link in windows 7

June 2nd, 2009

To create symbolic link in windows 7,then easiest way is to use command mklink.

C:\Windows\system32>mklink
Creates a symbolic link.
 
MKLINK [[/D] | [/H] | [/J]] Link Target
 
/D      Creates a directory symbolic link.  Default is a file
symbolic link.
/H      Creates a hard link instead of a symbolic link.
/J      Creates a Directory Junction.
Link    specifies the new symbolic link name.
Target  specifies the path (relative or absolute) that the new link
refers to.

Normally,we can use the option /D to create symbolic link.
Note:You need the admin privileges to run this command
runcmdasadmin

Example:

To create a symbolic link named MyDocs from the root directory to the \Users\User1\Documents directory, type:

mklink /D \MyDocs \Users\User1\Documents

Also we can use junction.exe or linkd.exe to create symbolic link in windows 7,you can  try them after put them to C:\windows\system32  if you have the interest.

40 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. Pavel Kostenko says:

    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. Thank you for puting the time in to publish this info. I found it very useful. If you are ever interested in submit web site directory then please contact me. says:

    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.

  23. Andrew says:

    If you create a link and have to remove it, you can’t do it via the folder browser. You have to use the command line to remove a symbolic link. Navigate to the directory that holds your link and type rmdir /S /Q linkName

  24. zombie stew says:

    I second LSE, Link Shell Extension

  25. PhilD says:

    @Andrew – I can delete symlinks on my win 7 system with the del or shift/del key, no need for the command line.

    The Lopesoft Filetools shell extension has Create Symbolic Link feature. It’s not nearly as comprehensive as Link Shell Extension, but its good enough for occasional use.

  26. Emergysator says:

    It is cool! Save your free disk space by using symbolic link yöur packages and updating directories if they are needed while programs are running. With this link you save all free disk space for windows 7 system.

    You can burn all World of Tanks or other online packages to dvd, other sds or hds.

    If you remove the program or game, no matter, symbolic link is stupid alone.

    Remember that the symbolic link can activate only from command console… deactivate…See other instructions before.

  27. MaxG says:

    Please note:
    Symbolic links do not work on RAM disks!

    Attempting to create one will result in:
    The device does not support symbolic links.

  28. GaryB says:

    There has been great confusion for years over what links do, how the types differ, and how to create and delete them.
    Wouldn’t you think Microsoft should feel some responsibility to publish a clear explanation about links?

  29. James Clarke says:

    Use sysinternals junction utility.. works like a charm

  30. Lashy says:

    Hi I created a mklink junction between C:\My Documents and D:\My Documents as my C: drive is running out of space. But when I add files in to D:\My Documnets the size of free space in C: also goes down is this normal or have I done something wrong
    These are the cmd’s I ran
    1. robocopy “C:\My Documents” “D:\My Documents” /E /COPYALL /XJ
    2. rmdir “C:\My Documents” /S /Q
    3. mklink /J “C:\My Documents” “D:\My Documents”

  31. cars says:

    Shopping for a new or used car can be a difficult process if
    you do not know what you are doing. By educating yourself about car shopping before you head to
    the dealership, you can make things easier for yourself.
    The following tips can help your next shopping trip be more enjoyable.

  32. Jessie says:

    Actually when ѕomeone doesn’t know then its up to other users that they will help, ѕo hеге it takes place.

  33. Rhonda says:

    Saved ɑs a favorite, Ӏ love your blog!

  34. [...] one issue.  The mklink command was for some reason undecipherable to me, so as per a suggestion here, I downloaded Directory Linker and filled [...]

  35. you’re actually a good webmaster. The site loading pace is amazing.
    It kind of feels that you are doing any unique trick. Moreover, The contents are masterpiece.
    you have done a fantastic job on this subject!

  36. Undeniably imagine that which you said. Your favourite justification seemed to be at the
    web the easiest factor to understand of. I say
    to you, I definitely get annoyed whilst other people consider worries that they plainly don’t realize about.
    You managed to hit the nail upon the highest and also defined out the whole thing without having side-effects
    , folks can take a signal. Will likely be back to get more.
    Thanks

Leave a Reply