Create symbolic link and junction using Mklink

Syntax

mklink [[/d] \| [/h] | [/j]] <Link> <Target>

Parameters

Parameter Description
/d Creates a directory symbolic link. By default, mklink creates a file symbolic link.
/h Creates a hard link instead of a symbolic link.
/j Creates a Directory Junction.
<Link> Specifies the name of the symbolic link that is being created.
<Target> Specifies the path (relative or absolute) that the new symbolic link refers to.
/? Displays help at the command prompt.

Changing the file name does not affect hard links.

A file in the file system is basically a link to an inode. A hard link creates another file with a link to the same underlying inode. When deleting a file, it removes one link to the underlying inode. The inode is only deleted (or deletable/over-writable) when all links to the inode have been deleted.

A symbolic link is a link to another name in the file system while being processed at the client side.

The system doesn’t follow symbolic links on remote volumes. Requires special privilege.

Junction

Same as a symbolic link but can point to remote filesystems.

Only requires access to the file system.

Further Reading

  1. What is the difference between a symbolic link and a hard link? | Stack Overflow
  2. “directory junction” vs “directory symbolic link”? | Super User
  3. Mklink | Microsoft Docs

Posted:

Comments