Map a Folder to a Drive Letter with subst

Give any folder its own drive letter with subst — instant, reversible, and perfect for long paths, scripts, and old apps expecting a drive root.

WindowsFilesfilesystemcmdLow risk
Run subst X: "C:\path\to\folder" to give the folder letter X:; remove it with subst X: /D and list all with plain subst.

01Command

Command
$ subst X: "C:\Users\me\Projects\Company\Web\v2\src"

02What it does

subst creates a virtual drive that is really just an alias for a folder — no partitioning, no admin rights, gone at reboot. It solves a handful of everyday problems: shortening painfully deep paths (which also helps with MAX_PATH issues in old tools), giving scripts a stable short path, and satisfying ancient programs that insist on being installed at a drive root. Unlike a mapped network drive it's local and instant, and unlike a junction the letter itself is the alias. Plain subst with no arguments lists the current mappings.

03Risk

RiskLow risk
RequirementsThe mapping lasts only until reboot; add a shortcut to shell:startup for a persistent one.
!Warning: The mapping is per-session: after a reboot it's gone, so put the command in the Startup folder (shell:startup) if you want it always. Some programs treat the virtual drive differently (defrag, backup tools) — for a permanent system-wide link use a junction instead.

04Undo

Undo
$ subst X: /D

05Sources

  • subst - SS64
    SS64 · technical · 2026-09-17
    Evidence: Documents subst's session-only persistence and the startup-folder trick for re-creating mappings at logon.
  • subst
    Microsoft Learn · vendor-doc · 2026-09-17
    Evidence: subst associates a path with a drive letter, lists current associations with no arguments, and removes one with subst X: /D.

Last verified: 2026-09-18 · Category: Files & Folders

06Related solutions