Research: junction behavior
This page records the platform behavior that shapes the product. It is shared research, not a user guide. It explains why the manager attempts operations and reports native results instead of guessing from a volume label.
Last reviewed: 2026-12-04.
Scope
The questions this research answers:
- What is a junction at the filesystem level?
- Which volumes can host a junction link, and which can host a target?
- How do broken junctions behave when inspected and removed?
- Which PowerShell and .NET calls are safe for creation, inspection, and detachment?
- Why does the product avoid a filesystem-type gate?
What a junction is
A junction is a directory reparse point. The directory entry carries a reparse tag and a small data buffer. When the I/O manager resolves the path, it reads the buffer and redirects to the stored target path.
flowchart LR
A["Path: C:\\link"] --> B["Directory entry<br/>FILE_ATTRIBUTE_REPARSE_POINT"]
B --> C["Reparse tag<br/>IO_REPARSE_TAG_MOUNT_POINT"]
C --> D["Reparse data<br/>substitute name + print name"]
D --> E["Target: D:\\data"]
Junctions and volume mount points share the IO_REPARSE_TAG_MOUNT_POINT tag (0xA0000003). A junction stores a directory path; a mount point maps a volume. A symbolic link uses IO_REPARSE_TAG_SYMLINK (0xA000000C) and can target files or directories, including remote UNC paths.
Junction vs symbolic link vs mount point
| Aspect | Junction | Directory symbolic link | Volume mount point |
|---|---|---|---|
| Reparse tag | IO_REPARSE_TAG_MOUNT_POINT | IO_REPARSE_TAG_SYMLINK | IO_REPARSE_TAG_MOUNT_POINT |
| Target kind | Local directory path | Local or remote path | Volume |
| Remote target | No | Yes (UNC) | No |
| Creation privilege | No symbolic-link privilege required | Symbolic-link privilege or Developer Mode | Typically administrative |
| Common creator | mklink /J, New-Item -ItemType Junction | mklink /D, New-Item -ItemType SymbolicLink | mountvol, disk management |
The product manages junctions only. A path whose LinkType is not Junction is reported as Not-A-Junction and is never modified.
Filesystem support
| Volume role | Requirement | Evidence |
|---|---|---|
| Host of the junction link | Must support reparse points | NTFS and ReFS support reparse points; FAT32 and exFAT do not |
| Host of the target directory | Any local filesystem the path can reach | The reparse buffer stores a path string; resolution happens through the I/O manager |
The important separation is link volume versus target volume. A target on a filesystem without reparse-point support is still a valid target. Only the link’s own volume must support the reparse point.
flowchart LR
A["NTFS system volume<br/>junction link"] -->|reparse redirect| B["FAT32 data volume<br/>target directory"]
C["FAT32 volume<br/>cannot host link"] -.->|native rejection| D["Operation fails"]
Observed behavior
The following were observed on Windows 11 with PowerShell 7 while building this project.
| Scenario | Call | Observed result |
|---|---|---|
| Link on an NTFS system volume targeting a directory on a FAT32 data volume | New-Item -ItemType Junction | Succeeds; the link resolves to the target |
| Link path placed directly on the FAT32 data volume | New-Item -ItemType Junction | Fails; Windows returns a native error such as “Incorrect function” or an NTFS-required message |
| Target directory missing | Get-Item on the link | Returns the link entry with LinkType = 'Junction' |
| Target directory missing | New-Item -ItemType Junction | Fails because the target must exist |
| Target directory missing | cmd /c mklink /J | Creates a junction whose target is absent |
| Existing junction | [System.IO.Directory]::Delete(path, $false) | Detaches the link; target and contents remain |
| Junction with a missing target | [System.IO.Directory]::Delete(path, $false) | Detaches the link successfully |
Exact error text varies by API, volume, and path. The product does not match on error strings; it surfaces the message unchanged.
API behavior
Inspection
Get-Item exposes reparse metadata through LinkType and Target:
$item = Get-Item -LiteralPath $Path -Force
$item.LinkType # 'Junction'
$item.Target # target path, or empty for some broken cases
$item.Attributes # includes ReparsePoint
A broken junction still returns an item, so stale links remain visible, inspectable, and removable. This is why the manager can report Stale-Orphaned and still act on the link.
Creation
New-Item -ItemType Junction is convenient but validates that the target exists. For broken-link fixtures and edge cases, mklink /J can create a junction to a missing target.
mklink /J requires cmd.exe, so the product’s normal creation path uses New-Item. The test kit falls back to mklink only where a broken link is required.
Detachment
[System.IO.Directory]::Delete($Path, $false)
The second argument is recursive: false. This deletes the reparse point itself. Passing $true is dangerous for links because it can traverse into the target and delete its contents. The product never uses a recursive delete on a junction path.
If the .NET call fails, the core retries with cmd /c rmdir "<path>", which also detaches the link rather than following it.
Target emptiness
Test-WjmTargetHasFiles walks the target recursively and stops at the first file. This is a content check, not a filesystem-type check. An empty directory is Stale-Empty regardless of the volume it lives on.
Why the product does not gate on filesystem type
A volume label is a poor predictor of whether a specific operation will succeed:
- the link and target can live on different volumes;
- a volume may support reparse points but reject a specific path due to ACLs, path length, or a filter driver;
- the exact native error is more useful than a guessed “not supported” message;
- new Windows builds and storage drivers change behavior over time.
The design therefore validates what it can know locally (path shape, protection, existence, containment) and then attempts the operation. The native result is the source of truth.
flowchart TD
A[Request] --> B[Validate path shape, protection, existence]
B -- invalid --> X[Reject with reason]
B -- valid --> C[Attempt native operation]
C --> D{Native result}
D -- success --> E[Report success]
D -- failure --> F[Surface native error]
Design consequences
| Decision | Reason |
|---|---|
| Status comes from target existence and content, not volume type | The link and target may live on different filesystems |
| Create, retarget, and repair attempt the native call | Only Windows knows whether the path is accepted |
| Removal uses non-recursive delete | A recursive delete could follow the link into the target |
| Inspection uses the reparse entry, not the target | Broken links must remain visible and removable |
| Restore checks target existence and protection, not volume type | Targets may live anywhere local |
| Test fixtures attempt and assert on native results | Avoids false skips and mirrors production behavior |
Canonical references
- Reparse points
- Reparse point tags
- Hard links and junctions
- File attribute constants
mklinkcommandNew-ItemGet-ItemDirectory.Delete
Open questions
- How do specific filter drivers and cloud-sync providers affect junction resolution for directories they manage?
- Do any supported Windows configurations allow a junction link on a non-NTFS volume through a third-party filesystem driver?
- How should the tool report a link whose reparse data is readable but whose target path is malformed?
These are tracked as research questions, not current behavior. The product continues to surface native results until a reliable, documented rule exists.