MKLink – Windows CMD Command

Create a symbolic link to a directory or a file, or create a hard file link or directory junction.

Types of Link

Can link to files?Can link to folders?Can link across hard drives?Supported on:Can point to a non-existent target?Can be relative?How to delete:
ShortcutYesYesYesWindows 95+YesNoDel
Hard linkYesNoNoWindows 3.5+No
NoDel
Junction
(soft link)
NoYesY (on the same computer)Windows 2000+YesNoRD
Symbolic linkYesYesYesVista+YesYes (on the same volume)RD folder or Del file

Symbolic links are transparent to users; the links appear as normal NTFS files or directories and can be acted upon by the user or application in exactly the same manner. Symbolic links can span volumes and can use UNC paths.

A symlink can be an absolute path C:\Programs or a path relative to the link’s location \Programs.

Symbolic Links and Directory Junctions are implemented using reparse points.

Hard Links are implemented with multiple file table entries that point to the same inode – the same as Unix hard links. If the original filename is deleted, the hard link will still work – it points directly to the data on disk.

It is possible (but not advisable) to create two links that point to each other in a loop or a link that targets itself. Symbolic links can expose security vulnerabilities in applications that aren’t designed to handle them.

List existing Links and Junctions

The standard DIR command will display Symbolic Links, indicated with <SYMLINKD>
The DIR /A:S command will display Junctions, indicated with <JUNCTION>

DIR /A:S %userprofile%

Elevation

By default, only Administrators can create symbolic links. The security setting ‘Create symbolic links’ can be granted at Configuration\Windows Settings\Security Settings\Local Policies\User Rights Assignment\

Creating a symbolic link requires elevation, but from Windows 10 build 14972, symlinks can be created without needing to elevate the console as administrator – this does however require that you have Developer Mode enabled.

Errorlevels

If the link was successfully created %ERRORLEVEL% = 0
Link could not be created or bad parameters given %ERRORLEVEL% = 1

You may also like...

17 Responses

  1. Marisol Ramirez says:

    I like the efforts you have put in this, regards for all the great content.

  2. Luis Hale says:

    I just like the helpful information you provide in your articles

  3. Reed Griffin says:

    This was beautiful Admin. Thank you for your reflections.

  4. Ismael Harding says:

    You’re so awesome! I don’t believe I have read a single thing like that before. So great to find someone with some original thoughts on this topic. Really.. thank you for starting this up. This website is something that is needed on the internet, someone with a little originality!

  5. Jovan Zuniga says:

    This is really interesting, You’re a very skilled blogger. I’ve joined your feed and look forward to seeking more of your magnificent post. Also, I’ve shared your site in my social networks!

  6. Alisson Coleman says:

    Awesome! Its genuinely remarkable post, I have got much clear idea regarding from this post

  7. Tate Summers says:

    I’m often to blogging and i really appreciate your content. The article has actually peaks my interest. I’m going to bookmark your web site and maintain checking for brand spanking new information.

  8. Charlie Clements says:

    This was beautiful Admin. Thank you for your reflections.

  9. Jasper Roach says:

    For the reason that the admin of this site is working, no uncertainty very quickly it will be renowned, due to its quality contents.

  10. Chace Weaver says:

    Pretty! This has been a really wonderful post. Many thanks for providing these details.

  11. Kylee Fisher says:

    Hi there to all, for the reason that I am genuinely keen of reading this website’s post to be updated on a regular basis. It carries pleasant stuff.

  12. Londyn Eaton says:

    Good post! We will be linking to this particularly great post on our site. Keep up the great writing

  13. Delaney Koch says:

    This was beautiful Admin. Thank you for your reflections.

  14. Lillianna Mccarty says:

    I’m often to blogging and i really appreciate your content. The article has actually peaks my interest. I’m going to bookmark your web site and maintain checking for brand spanking new information.

  15. Scott Vasquez says:

    This was beautiful Admin. Thank you for your reflections.

  16. zortilonrel says:

    Hello my friend! I wish to say that this post is amazing, nice written and include approximately all significant infos. I would like to see more posts like this.

  17. froleprotrem says:

    You are my inspiration , I possess few blogs and rarely run out from to brand.

Leave a Reply

Your email address will not be published. Required fields are marked *