DayPath Journal

Generating a Junction (not technically a symbolic link) in Windows 10

Rarely, I ran into the 260-character limit on Windows paths. According to Microsoft’s summer of 2016, I will never run into this limit again. For the other billion non-Windows-10, Windows machines, I may need this:

Set-Location C:\
$junction = "my-junction"
$target = "C:\my-really-really-really-long-path"
if(Test-Path $junction)
    Write-Output "$junction junction already exists."
& cmd /c mklink /J $junction $target
Get-ChildItem -Path $junction

I will note that I attempted to use the mklink /d switch (on a pre-summer-of-2016 version of Windows 10) for a directory Symbolic Link but this failed silently.

Relevant Links