# 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.

**Tested on**

- Build: 26300.9457 / 26100.33650
- Edition: Pro (26H2) / Server
- Architecture: x64
- Evidence: E1
- Verified: 2026-10-29

## 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

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.

```powershell
# move the real folder to D:, leave a junction behind
Robocopy "C:\ProgramData\Vendor" "D:\Data\Vendor" /E /MOVE
New-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.

> **Caution: Do not junction system folders**
>
> `C:\Windows`, `C:\Program Files` and `C:\Users` are not safe junction targets. Windows servicing, WinRE and update rollback assume real paths. Move user data and application data, not the OS.

## 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.exe` and some backup tools handle it differently.

Workarounds that always work:

- **Shorten the root** — `D:\p\` instead of `D:\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.

```powershell
# current setting
Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name LongPathsEnabled
```

## 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

- [File Explorer in Windows 11](https://winbook.fyi/en/windows/files/explorer/)
- [Storage Sense and Disk Cleanup](https://winbook.fyi/en/windows/files/storage-sense/)
- [WSL2 and file performance](https://winbook.fyi/en/windows/dev/wsl2/)

## 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.

## Sources

- [Microsoft Learn — Hard links and junctions](https://learn.microsoft.com/en-us/windows/win32/fileio/hard-links-and-junctions)
- [Microsoft Learn — Maximum file path limitation](https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation)
- [Microsoft Learn — Windows Shell](https://learn.microsoft.com/en-us/windows/win32/shell/)

---

Source: https://winbook.fyi/en/windows/files/symlinks-long-paths/
