Symlinks, junctions and the long-path limit
How symbolic links, junctions and hard links differ, when each is the right tool, and how to get past the 260-character path limit.
- Build
- 26300.9457 / 26100.33650
- Edition
- Pro (26H2) / Server
- Architecture
- x64
- Support
- Documentation (E1)
- Evidence
- E1Official documentation
- Verified
- 2026-10-29
- Page type
- Method
The short answer
Section titled “The short answer”Three link types, three very different behaviours:
| Type | Command | Points to | Survives move? |
|---|---|---|---|
| Symbolic link (file or dir) | New-Item -ItemType SymbolicLink |
a path string | breaks if target moves |
| Junction (directory only) | New-Item -ItemType Junction |
a local volume path | tracks the target |
| Hard link (file only) | New-Item -ItemType HardLink |
the same file data | is the file |
Use a junction to relocate a folder that software insists on finding at a fixed path. Use a symlink when you want a transparent pointer and can accept the path dependency. Use a hard link almost never — it is the same file with two names.
Why junctions still matter
Section titled “Why junctions still matter”Plenty of software hard-codes paths: C:\ProgramData\Vendor, C:\Users\Public\Documents, game save folders. You cannot change the app, and you do not want that data on the system drive.
# move the real folder to D:, leave a junction behindRobocopy "C:\ProgramData\Vendor" "D:\Data\Vendor" /E /MOVENew-Item -ItemType Junction -Path "C:\ProgramData\Vendor" -Target "D:\Data\Vendor"/MOVE keeps the ACLs with /COPYALL if you add it; a plain move across volumes can lose explicit permissions on some setups.
The 260-character limit
Section titled “The 260-character limit”The classic MAX_PATH is 260 characters. Windows 10 1607+ can exceed it, but only when both the policy is enabled and the application opts in via manifest.
- Enable it:
HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled = 1(or Group Policy). - Applications built without long-path awareness still fail at 260.
- Explorer,
cmd.exeand some backup tools handle it differently.
Workarounds that always work:
- Shorten the root —
D:\p\instead ofD:\Projects\2026\Client Name\... - Use the
\\?\prefix for APIs that accept it (\\?\D:\very\long\path). - Keep OneDrive/SharePoint paths shallow — synced paths amplify the limit.
# current settingGet-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name LongPathsEnabledWhat breaks with links
Section titled “What breaks with links”| Tool | Behaviour |
|---|---|
| Backup/sync tools | may follow links (duplicating data) or skip them |
robocopy |
/SL follows symlinks, /XJ skips junctions |
| Antivirus | usually fine, occasionally loops on cyclic links |
| Disk usage tools | double-count or refuse |
Always tell your backup tool what to do with links, or you will either miss data or back up the same 500GB twice.
Related
Section titled “Related”Lab boundary
Section titled “Lab boundary”E1. Link semantics and the long-path policy are documented by Microsoft. No links were created on the lab VMs for this page.