How to create a Symbolic Link on Windows 10?

105

42

Was reading http://www.dropboxwiki.com/tips-and-tricks/sync-game-saves-across-multiple-computers and I know junction/mklink worked in Windows 7 as well, but seems like the junction command has been retired in Windows 10.

What's the correct way to make symlinks in Windows 10?

red

Posted 2016-01-02T11:43:39.413

Reputation: 1 306

2

You can download junction from Windows SysInternals (which is part of Microsoft).

– DavidPostill – 2016-01-02T11:53:27.930

That worked, thanks a lot! If you reply, I can accept it as the correct answer. – red – 2016-01-02T11:58:21.967

Great. I will write it up as an answer. – DavidPostill – 2016-01-02T11:58:57.100

9What’s wrong with mklink? – Daniel B – 2016-01-02T12:35:00.050

Anyone has good or bad info about junctions within (corporate) roaming profiles? (i.e.) trouble lurking... – Frank Nocke – 2020-01-13T08:41:42.500

Answers

124

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 unlike mklink.

  • mklink is an internal command only available within a cmd 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

DavidPostill

Posted 2016-01-02T11:43:39.413

Reputation: 118 938

Is this different to mklink /j? – Jonno – 2016-01-02T15:51:19.590

1@Jonno As far as I know it is the same when creating junctions. junction will also list junctions unlike mklink – DavidPostill – 2016-01-04T09:31:52.643

2As far as I can tell, you cannot use mklink inside PowerShell, so you must use cmd.exe. Also, you have to run it as Administrator. But don't take my word for it. I've been using a Windows computer for only about 40 hours. – Bruno Bronosky – 2016-01-05T18:52:54.933

@BrunoBronosky Correct. That is because mklink is an internal command only available within a cmd shell. Note some cmd internal commands have been implemented in PowerShell, for example dir. – DavidPostill – 2016-01-05T19:12:25.980

@BrunoBronosky By default Administrator privileges are required. 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\ – DavidPostill – 2016-01-05T19:13:47.947

@BrunoBronosky Thanks for the comments. I've updated the answer. – DavidPostill – 2016-01-05T19:17:42.680

@BrunoBronosky There are some PowerShell equivalent for mklink, see Powershell Hard and Soft Links, for example.

– DavidPostill – 2016-06-04T14:03:20.707

-1: Cites question "How do I create junctions or directory symbolic links in Windows 10?" then gives junction multiple times as an answer, then much further down bold It seems like the junction command has been retired in Windows 10. Can definitely be a lot clearer. – WBT – 2018-12-24T18:18:48.077

@WBT Rearranged a bit. – DavidPostill – 2018-12-24T19:25:47.097

2@DavidPostill An improvement, but still lots of focus on junction which requires a separate download. mklink would seem to work better as the main focus, with junction framed as an additional retired option at the end. – WBT – 2018-12-26T15:01:00.690

@WBT {shrug} it answers the question as asked. – DavidPostill – 2018-12-26T15:03:10.280

46

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.

Peter Hahndorf

Posted 2016-01-02T11:43:39.413

Reputation: 10 677

7Surely in 2016, I should not have to jump through hoops to create symlinks! Still one of windows biggest fails. – David Arno – 2016-12-02T20:30:24.083

12You're joking, right? I'd much rather do "mklink /d test-dir-sym-link test" than "New-Item -ItemType SymbolicLink -Path E:\Data\MyGames -Target "C:\users\UserName\MyGames". The super-verbose PowerShell syntax isn't really to my liking... – Jaime de los Hoyos M. – 2016-12-13T12:00:40.973

8@JaimedelosHoyosM - using shorter PowerShell syntax you can use ni test-dir-sym-link -i SymbolicLink -ta test – Peter Hahndorf – 2017-05-06T10:29:18.800

Is there a way to create a SymbolicLink from the PowerShell like this without administrator privileges? – cjsimon – 2018-06-12T23:38:18.800

Is there a way to list the less verbose syntax using Get-Help? For instance how did you find -ta is for -Target – scape – 2019-01-24T15:19:26.183

2@scape - you can use the first few letters of a parameter name if they they uniquely identify the paramter, e.g. -i are enough for -ItemType but -t is not enough because there are more than one parameter that start with t, so we need to use -ta – Peter Hahndorf – 2019-01-24T16:46:59.727

16

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.

enter image description here

odvpbre

Posted 2016-01-02T11:43:39.413

Reputation: 161

3

Please read How do I recommend software for some tips as to how you should go about recommending software. You should provide at least a link, some additional information about the software itself, and how it can be used to solve the problem in the question.

– DavidPostill – 2016-10-24T15:59:52.147

1It's a nice tool, but some more information in the answer would be nice. – DavidPostill – 2016-10-24T16:00:13.040

0

No need to install anything!

There exists a simple and open-source symlink_creator.bat file, and you can just drag & drop desired file/folder onto that file.


To curious downvoters: it's open-source, so, just right click on file and see it's content yourself, several lines of codes there.

T.Todua

Posted 2016-01-02T11:43:39.413

Reputation: 2 436

8You should add in your answer how exactly this batch file works and what your association with it is. Batch files can be very destructive and running random ones from the internet goes against common sense. – MoonRunestar – 2018-03-19T13:45:06.750

what's more it's interesting you havent commented these words to the above answer, which links to unknown program, and the link i used, links to open-source code. – T.Todua – 2018-03-19T13:55:51.657

1The answer above has already had a moderator comment on it. I was mainly concerned with your answer because that website you linked looks somewhat sketchy, and the format of your answer triggered some red flags for me. I'm just being paranoid really. – MoonRunestar – 2018-03-19T14:58:07.963

unfortunately, it finishes with an error "syntax is incorrect" – tutejszy – 2019-09-17T11:25:13.220