Tuesday 26 February 2019

How to create a Symbolic Link on Windows 10?


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?



Answer



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



No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...