Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Safety and protected paths

Safety is enforced in the core, not only in the menus. The TUI and the CLI both call the same validation and protection functions.

Protected paths

These paths are never created, retargeted, removed or deleted:

CategoryExamples
Drive rootsC:\, D:\
Windows system%SystemRoot%, %SystemRoot%\System32
Program locations%ProgramFiles%, %ProgramFiles(x86)%
User rootsC:\Users, C:\Users\Public, C:\Users\Default, C:\Documents and Settings
User profile%USERPROFILE% and compatibility names: Application Data, Cookies, Local Settings, My Documents, NetHood, PrintHood, Recent, SendTo, Start Menu, Templates, Desktop, Documents, Downloads
Local app data%LOCALAPPDATA% and Application Data, History, Temporary Internet Files
Roaming app data%APPDATA%
Program data%ProgramData% and Application Data, Desktop, Documents, Start Menu, Templates

Protection uses normalized, case-insensitive equality against the protected set. It does not treat a path as protected merely because the string starts with a protected name.

Validation rules

Before a junction is created, the core checks:

  1. A junction path and target are both supplied.
  2. The junction path is not a drive root.
  3. The junction path is not protected.
  4. Neither path is a UNC network path.
  5. The junction path and target are different.
  6. The junction path is not inside its own target.
  7. The target exists and is not protected.
  8. The junction path does not already exist.
  9. The parent directory of the junction path exists.

Failures are collected and reported together, so a user sees every problem at once.

flowchart TD
    A[Request] --> B{Path and target supplied?}
    B -- No --> X[Reject]
    B -- Yes --> C{Protected, UNC, drive root or nested?}
    C -- Yes --> X
    C -- No --> D{Target exists and is local?}
    D -- No --> X
    D -- Yes --> E{Link path already exists?}
    E -- Yes --> X
    E -- No --> F[Create]

Protected compatibility junctions

Windows keeps compatibility junctions in user profiles and ProgramData. These are exactly the links this tool must never touch. The protected set includes their common names and the user-profile roots, and scanning excludes protected records by default.

Dry-run guarantees

Every mutating operation accepts --dry-run (CLI) or the D toggle (TUI):

OperationDry-run result
CreateReturns a preview result; no link is created
RetargetReturns a preview; the existing link is untouched
RepairReturns a preview; no link is recreated
RemoveReports the link that would be detached; nothing is removed
CleanupReports counts and per-link results; nothing is removed
Empty-target deleteReports the directory; nothing is deleted
Export / backupReports the destination; no file is written
RestoreCounts what would be created or skipped; no link is created

Removal semantics

Removing a junction detaches the reparse point. It does not follow the link and does not delete target contents. The operation uses a non-recursive directory delete, with rmdir as a fallback.

sequenceDiagram
    participant U as User
    participant C as Core
    participant W as Windows
    U->>C: Remove junction
    C->>C: Inspect (exists, is junction, not protected)
    C->>W: Detach reparse point
    W-->>C: Success
    C-->>U: Link removed; target preserved

Empty-target deletion

remove-empty-target and --clean-stale-empty include additional guards. The directory must:

  • exist,
  • not be protected,
  • not be a drive root,
  • not itself be a junction,
  • contain no files,
  • contain no nested reparse points.

If any guard fails, the operation stops with an explanatory error.

Retarget rollback

Retarget removes the old link and creates a new one. If creation fails and the previous target still exists, the core attempts to recreate the original link and reports the failure. This keeps a failed retarget from leaving the application without its junction when recovery is possible.

Restore guards

Restore never overwrites existing paths. A record is skipped when:

  • its link path is protected,
  • its link path already exists,
  • its target directory is missing.

Only missing links with present, unprotected targets are recreated.

Filesystem behavior

The tool does not gate on filesystem type. Targets may live on any local filesystem, and operations are attempted through Windows. If a volume rejects a reparse point, the native error is surfaced and the caller can decide what to do. See Research: junction behavior for the underlying platform notes.