mklink is a built-in Command Prompt command that creates symbolic links, hard links and directory junctions, special file system entries that make one path lead to a file or folder stored somewhere else. In Windows storage & file systems, it is the classic tool for redirecting paths without copying data, for example to move a large folder to another drive while applications keep using the original location.
The links that mklink creates are features of NTFS, implemented either as additional directory entries (hard links) or as reparse points that the file system follows when a program opens the path. Understanding which type to create is the main skill the command requires.
Syntax and link types of mklink
The mklink syntax is mklink [/D | /H | /J] Link Target, where Link is the new path and Target is the existing item. Note the order, which is the reverse of many Unix habits: the name being created comes first. Without a switch, mklink creates a file symbolic link.
The table below summarizes the four forms of the command and what each produces.
| Command form | Creates | Target type |
|---|---|---|
mklink Link Target | File symbolic link | File, local or remote |
mklink /D Link Target | Directory symbolic link | Folder, local or remote |
mklink /H Link Target | Hard link | File on the same volume |
mklink /J Link Target | Directory junction | Folder on a local volume |
Because mklink is an internal command of cmd.exe, it does not exist as a separate program. In PowerShell the equivalent is New-Item with -ItemType SymbolicLink, Junction or HardLink, or the command can be invoked through cmd /c mklink.
How the different links work inside NTFS
Each link type works through a different NTFS mechanism, which explains its rules. A hard link is simply a second name for the same file record in the Master File Table, so both names are equal and the data disappears only when the last name is deleted. That is why hard links cannot cross volumes and cannot point to folders.
Symbolic links and junctions are reparse points: small records attached to an empty file or folder that tell the I/O manager to substitute another path. A symbolic link stores a path that can be relative or absolute and may point to network shares, while a junction stores an absolute local path and is resolved on the system that hosts it. Directory listings mark these entries with labels such as SYMLINK, SYMLINKD and JUNCTION.
The following comparison shows how the three link families differ in practice.
| Property | Symbolic link | Junction | Hard link |
|---|---|---|---|
| Applies to | Files and folders | Folders only | Files only |
| Cross-volume | Yes | Yes, local only | No |
| Network targets | Yes, policy dependent | No | No |
| Relative paths | Supported | Not supported | Not applicable |
| Privilege needed | Admin or Developer Mode | None beyond write access | None beyond write access |
| If target is deleted | Link becomes dangling | Link becomes dangling | Data remains via the link |
Permissions and policy that affect mklink
Creating symbolic links requires the Create symbolic links user right, which Windows grants to administrators by default. Since Windows 10 version 1703, enabling Developer Mode allows standard users to create symbolic links from an unelevated prompt, which is why development tools increasingly rely on them. Junctions and hard links need only write access to the location of the new entry.
Following symbolic links is controlled separately by the symlink evaluation policy, viewable with fsutil behavior query SymlinkEvaluation. It defines whether links of four kinds are followed: local-to-local, local-to-remote, remote-to-local and remote-to-remote. By default remote-to-local and remote-to-remote evaluation is disabled, a protection against links on file shares that redirect clients to their own disks.
Practical uses of mklink
mklink is most valuable when software expects data at a fixed path that the administrator wants to change. The decision table below matches common goals with the appropriate link type.
| Goal | Recommended link | Reason |
|---|---|---|
| Move a game or cache folder to another drive | Junction | No privileges, local volumes only |
| Point a config path to a synced folder | Directory symbolic link | Supports relative and remote paths |
| Share one large file between two folders | Hard link | No extra space on the same volume |
| Keep a stable path to a versioned tool | Junction or symbolic link | Repoint without changing scripts |
| Link to a folder on a file server | Directory symbolic link | Junctions cannot target UNC paths |
A typical relocation sequence is to close the application, move the folder to the new drive, then create a junction at the old path, for example mklink /J "C:\Data\Cache" "D:\Cache". Windows itself uses junctions for backward compatibility, such as the legacy Documents and Settings path that points to the Users folder.
Common mistakes and risks
Most problems with mklink come from misunderstanding what deletion and copying do to links. The table below lists frequent symptoms with their causes and fixes.
| Symptom | Cause | Fix |
|---|---|---|
| Error that the file already exists | Link path already exists | Move or rename the original first |
| Privilege not held error | Symbolic link right missing | Elevate or enable Developer Mode |
| Link works locally but not over a share | Evaluation policy blocks it | Review SymlinkEvaluation settings |
| Backup contains data twice | Tool follows links | Configure the tool to skip reparse points |
| Target deleted unexpectedly | Recursive delete followed a link | Remove links with rmdir first |
- Remove a link, not its target. Use
delfor a file symbolic link andrmdirwithout the /S switch for a directory link or junction; both remove only the link. - Avoid link loops. A junction pointing to its own parent can trap recursive tools in endless traversal.
- Treat links as a security surface. Attackers abuse junctions and symbolic links in link-following attacks against privileged services, so writable folders used by such services need careful permissions.
Understanding it simply
mklink makes signposts in the file system. A signpost looks like a normal file or folder, but when a program opens it, Windows quietly sends the program to the real location somewhere else.
This lets you move a big folder to a second drive while programs still find it at the old address. Deleting a signpost removes only the signpost, not the files it points to, unless it is a hard link, which is really a second name for the same file.
Applied in practice
A video editor works on a laptop with a 512 GB system drive that is nearly full. Her editing software stores about 180 GB of render cache in a fixed folder under her user profile and offers no setting to change it. She attaches a fast 2 TB external SSD that stays connected at her desk.
She closes the software, moves the cache folder to the SSD and runs mklink /J from the old location to the new one. No administrator prompt is needed because a junction requires only write access. The software starts normally, writes new cache files straight to the SSD and never notices the change. The outcome is about 180 GB of reclaimed space on the system drive in a few minutes, and she can undo it later by deleting the junction with rmdir and moving the folder back.