Junction points can prove incredibly useful. Basically they can allow you to present a folder in another location separate from where it actually is, effectively spoofing it’s location.
I’ve used them to can enable circumnavigation of the 256 character limit in folder structures by redirecting a folder to another location. I’ve also used them to host a folder structure on one drive but present it to another drive for ease of access.
In Vista, Server 2008 and Windows 7 they’re used to enable interoperability with legacy applications because the default location of user data has changed. An example of this change is the Documents and Settings directory, which has been moved from %systemdrive%\Documents and Settings to %systemdrive%\Users. When you browse the folder structure both folders are displayed but only one exists.
I detail the use of two tools here, linkd which is included in the Windows Server 2003 Resource Kit Tools and mklink which is included in Windows Server 2008 and above.
Linkd
To create a junction point from one location to another open a cmd prompt and navigate to where the linkd tool is, typically ‘C:\Program Files (x86)\Windows Resource Kits\Tools’.
From here you can use the linkd tool to create a junction point, the syntax of the tool is:
linkd <Source> <Destination>
For example: linkd C:\Temp\Junction C:\Original – This will create a junction point in the Temp folder called ‘Junction’ linked to the ‘Original’ folder.
N.B. The syntax is slightly misleading (well it is to me) and the is the junction point you will be creating.
Mklink
Open a cmd prompt as above but there is no need to navigate to the location of the mklink tool.
The syntax of the tool is:
mklink /J <Source> <Destination>
For example: mklink /J C:\Temp\Junction C:\Original – As above this will create a junction point in the Temp folder called ‘Junction’ linked to the ‘Original’ folder.
The /J switch is required to create the junction point as a directory and not a file which is the default action.
Once the junction point has been created you can alter the ACL’s like any other folder and not affect the original folder.
From a cmd line if you list the directories the folder will be described as.
N.B. If you’re using Windows Server 2008 and above don’t forget to run the cmd prompt as Administrator.
Long Path Tool can also do the same task very efficiently.