mklink - Create Links
The mklink command creates links on the file system.
They are similar to Explorer shortcuts, but links created with mklink are handled at the file-system level, so command lines and applications can use them almost like ordinary files and folders.
mklink command syntax
mklink [[/d] | [/h] | [/j]] <link> <target>
| Element | Description |
|---|---|
<link> | Path of the new link to create |
<target> | Path of the file or folder the link points to |
/d | Creates a symbolic link to a directory |
/h | Creates a hard link to a file |
/j | Creates a directory junction |
Link types
Choose the type of link according to your purpose.
| Type | How to create | Main use |
|---|---|---|
| File symbolic link | No option | Refer to a file located elsewhere |
| Directory symbolic link | /d | Refer to a whole folder from another location |
| Hard link | /h | Give one file multiple names on the same volume |
| Directory junction | /j | Refer to a local folder from another location without administrator rights |
A shortcut is a .lnk file, whereas a symbolic link is a file-system link.
When used from commands or applications, a mklink link is often more natural to work with than a shortcut.
The main differences between symbolic links and junctions are as follows.
| Item | Symbolic link | Directory junction (/j) |
|---|---|---|
| Target | Files and folders | Folders only |
| Relative target path | Allowed | Stored as an absolute path |
| Network paths | Allowed | Not allowed (local only) |
| Administrator rights | Usually required | Not required |
If you cannot use administrator rights but want to expose a folder at another location, a junction is the easy choice.
Basic usage
Create a symbolic link to a file
mklink C:\work\latest.log C:\logs\2026-04-20.log
Create a symbolic link to a folder
mklink /d C:\work\assets D:\shared\assets
Create a hard link
mklink /h C:\work\report-latest.txt C:\archive\report.txt
Hard links can only be created for files and must be on the same volume. They cannot be used for folders.
Create a directory junction
mklink /j C:\work\current D:\projects\current
Check the links you created
When you run the dir command, links are shown as <SYMLINK> (file symbolic link), <SYMLINKD> (folder symbolic link) or <JUNCTION> (junction). Hard links are not distinguished from ordinary files.
dir C:\work
Which one should I use?
- To refer to a folder across drives, first consider a symbolic link or a junction.
- To give one file multiple names, a hard link is suitable.
- To have batch files or tools treat it “like a real path”,
mklinkis better than a shortcut.
Notes
In many environments, creating a symbolic link requires administrator rights. However, on Windows 10 / 11 with Developer Mode enabled, you may be able to create them without administrator rights.
- Symbolic links can be created with either relative or absolute paths.
- A hard link is another name for the same data as the original file. Deleting one name does not stop you from reading the content through the other.
- When you create a symbolic link with a relative path, the target is interpreted relative to the location of the link.
- Deleting a link with the proper command does not delete the original file or folder it points to.
How to delete a link
To delete only the link, use the deletion command that matches the type of link.
Delete a file link
del C:\work\latest.log
Delete a directory link or junction
rmdir C:\work\assets
Running del on a folder symbolic link or junction deletes the files inside the target folder.
To remove a folder link, always use rmdir (without /s).
What you delete here is only the link. To delete the actual target, specify the original path.