Using SUBST to Create Virtual Drives in Windows

Ever wish you could turn a long, annoying folder path into its own drive letter — instantly?

Good news: Windows has had a secret command for that since the stone age (aka DOS). It’s called SUBST, and it lets you create a virtual drive letter for any local folder. Think of it as a symbolic link’s chill, drive-mapping cousin.

What Is SUBST?

SUBST stands for “substitute”, and it lets you assign a drive letter to a local path.
It doesn’t move or duplicate anything — it just maps a folder as if it were a separate drive.

You know that 100-character-long C:\Users\Zaur\Projects\SuperImportant\StuffToDemo path?
You can turn it into Z:\ in one line.

Basic Syntax

cmd
SUBST <DriveLetter>: <FolderPath>

Example:

cmd
SUBST Z: "C:\scripts"

Now you can access Z:\ in Explorer, Command Prompt, or any app — and it will point to that long path.

How to Remove a SUBST Drive

cmd
SUBST Z: /D

Boom. The drive disappears. No files deleted. Nothing moved. It’s like it never happened.

See All Current Mappings

cmd
SUBST

This lists all current virtual drives created with SUBST.

Why Use It?

Common Use Cases:

  • Shorten long, deep file paths for easier navigation
  • Simplify dev environments (e.g. set W:\ for your web root)
  • Help legacy apps that expect to run from a drive root
  • Create throwaway drives for testing installs, scripts, or tools

Caveats to Know

  • Mappings made with SUBST do not persist after reboot unless added via script or registry
  • SUBST drives behave like local drives in Explorer, but some software (especially older ones) might not fully support them
  • Doesn’t work with network shares — only local paths

Pro Tip: Make It Persistent

To keep your SUBST drive alive after reboot:

Option 1: Add it to a startup script (Task Scheduler or Startup folder)

cmd
SUBST Z: "C:\Path\To\Folder"

Option 2: Use the Registry (manual but reliable)

Add under:

regedit
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices

Add a new String Value:

  • Name: Z:
  • Data: \??\C:\Path\To\Folder

⚠️ Note: The \??\ prefix is important — it tells Windows this is a symbolic path.

To Remove the Mapping

  • Go back to the same registry key
  • Delete the string value (e.g. Z:)
  • Reboot

Extra Notes

ThingDetail
Drives created this wayShow up like real drives
Still point to foldersNo duplication — just a redirected path
Affects all usersSince it’s under HKLM
Requires admin rightsYes — it’s editing system-wide settings

In a nutshell:

CommandWhat it does
SUBST Z: C:\FolderMaps folder to a virtual drive
SUBSTLists all current mappings
SUBST Z: /DDeletes the mapping
Registry + DOS DevicesMakes the mapping persistent on reboot

Final Thoughts

SUBST might not be flashy, but it’s a lightweight tool that can seriously declutter your daily workflow. Whether you’re coding, scripting, or just sick of typing long paths, it’s a shortcut worth remembering.

Got a favorite SUBST trick or using it in your workflow? Drop a comment — or stay tuned for a post on net use and mapping network drives the smart way. 😉

Leave a Comment