How can I create a symbolic link on Windows 10?
It seems like the junction command has been retired in Windows 10.
You can download junction from Windows SysInternals (which is part of Microsoft):
Junction not only allows you to create NTFS junctions, it allows you to see if files or directories are actually reparse points. Reparse points are the mechanism on which NTFS junctions are based, and they are used by Windows' Remote Storage Service (RSS), as well as volume mount points.
Please read this Microsoft KB article for tips on using junctions.
Note that Windows does not support junctions to directories on remote shares.
So how do I create junctions or directory symbolic links in Windows 10?
Download junction
as instructed above.
Now you can use the following commands.
Create a junction:
junction "C:\Documents and Settings\UserName\My Documents\My Dropbox\My Games" "C:\Documents and Settings\UserName\My Documents\My Games"
Create a directory symbolic link:
mklink /D "C:\Documents and Settings\UserName\My Documents\My Dropbox\My Games" "C:\Documents and Settings\UserName\My Documents\My Games"
You can use either mklink /j
or junction
in Windows 10 to create junctions.
You can use mklink /d
in Windows 10 to create directory symbolic links.
Notes:
-
junction
can also list junctions and determine if a file is a junction unlikemklink
. -
mklink
is an internal command only available within acmd
shell. -
By default Administrator privileges are required to create symbolic links.
It can also be granted to other users. The security setting "Create symbolic links" can be granted at:
Configuration\Windows Settings\Security Settings\Local Policies\User Rights Assignment\
Examples
Using mklink to create a directory symbolic link:
F:\test>mklink /d test-dir-sym-link test
symbolic link created for test-dir-sym-link <<===>> test
Using mklink to create a junction:
F:\test>mklink /j test-junction test
Junction created for test-junction <<===>> test
Using junction to create a junction:
F:\test>C:\apps\NirSoft\SysinternalsSuite\junction.exe test-junction test
Junction v1.06 - Windows junction creator and reparse point viewer
Copyright (C) 2000-2010 Mark Russinovich
Sysinternals - www.sysinternals.com
Created: F:\test\test-junction
Targetted at: F:\test\test
Further Reading
- An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.
- mklink - Create a symbolic link to a directory or a file, or create a hard file link or directory junction.
Open a PowerShell session as elevated administrator and type:
New-Item -ItemType SymbolicLink -Path E:\Data\MyGames -Target "C:\users\UserName\MyGames"
or using less verbose syntax:
ni E:\Data\MyGames -i SymbolicLink -ta "C:\users\UserName\MyGames"
Surely in 2016 and with Windows 10 you don't want to fiddle around with cmd commands or external downloads.
Windows 10 comes with PowerShell 5 which has builtin support for creating symbolic links.
If you want a GUI Tool for making/editing that symlinks use http://schinagl.priv.at/nt/hardlinkshellext/linkshellextension.html
Link Shell Extension (LSE) provides for the creation of Hardlinks , Junctions , Volume Mountpoints , and Windows7/8's Symbolic Links, (herein referred to collectively as Links) a folder cloning process that utilises Hardlinks or Symbolic Links and a copy process taking care of Junctions, Symbolic Links, and Hardlinks. LSE, as its name implies is implemented as a Shell extension and is accessed from Windows Explorer, or similar file/folder managers. The extension allows the user to select one or many files or folders, then using the mouse, complete the creation of the required Links - Hardlinks, Junctions or Symbolic Links or in the case of folders to create Clones consisting of Hard or Symbolic Links. LSE is supported on all Windows versions that support NTFS version 5.0 or later, including Windows XP64 and Windows7/8/10. Hardlinks, Junctions and Symbolic Links are NOT supported on FAT file systems, and nor is the Cloning and Smart Copy process supported on FAT file systems.
If you have Windows 10 build 14972 (December 2016) or higher:
https://blogs.windows.com/windowsdeveloper/2016/12/02/symlinks-windows-10
you can enable developer mode:
https://howtogeek.com/292914/what-is-developer-mode-in-windows-10
then use mklink
without admin. Alternatively, PowerShell 6.2.0 (March 2019) or
higher allow Symlink without admin:
New-Item -ItemType SymbolicLink -Path new.txt -Target old.txt