I have a registry key under [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run] The value of the key is

"c:\windows\system32\cmd.exe" /c subst t: e:\MyFolder

More often than not when I boot the computer the subst command appears to only half work. If I open a command prompt I can use t: fine. However if I look in windows explorer T: is not there and if I type it into the address bar I get an error message saying "Windows can't find 't:'. Check the spelling and try again."

This is on Windows 7 Enterprise 64 bit.

Any ideas?

  • i've never used subst myself, but this is what Wikipedia has to say on setting up a persistent mapping. hope it helps
    – Xantec
    Dec 2 '10 at 14:03
  • @Dan, Here: How to make SUBST mapping persistent across reboots? ..
    – Pacerier
    Jan 15 '16 at 19:24
  • There are so many layers of APIs and wrapper .DLLs in Windows that it's actually surprising when you make a change that is indeed visible everywhere. The command first appeared under DOS so that's it's "expected" environment.
    – LawrenceC
    Mar 2 '18 at 14:12

This command creates a persistent Z: subst of C:\DirectoryName

reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices" /v Z: /t REG_SZ /d "\??\C:\DirectoryName" /f
  • +1. Still works in Windows Server 2012. Needs a restart.
    – Neolisk
    Jan 7 '14 at 18:50
  • It does not work on my Windows 10 machine with version 1607/build 14393. Can anyone confirm? Nov 17 '17 at 10:46
  • Windows 2019 Server, still works, so Win10 should work, too. But because the setting is in HKLM, a reboot is required, a mere logoff is not enough.
    – vic
    Feb 19 '20 at 16:30

This probably happens because the run command runs elevated (as administrator). If you run the subst command not elevated you will see it in Windows Explorer. You can test this running the subst on an elevated command prompt.

  • 1
    I tried this, but it still didn't take.
    – Jim Fell
    Mar 23 '13 at 20:47
  • Did not believe this would work, but you were right! it worked i mapped my dropbox to Z: on the fly. well done Feb 8 '14 at 14:16
  • Does not work on Windows 10 Mar 22 '16 at 9:14
  • 2
    @Starnutoditopo, it works fine in Windows 10, assuming the cmd shell isn't elevated.
    – Eryk Sun
    Jul 20 '16 at 23:50

Use PSubst 3 utility. It is a DOS batch file that maps a drive permanently. Works in every windows version after XP.

Github Repository

Download latest version Direct link



This is original repository of the psubst tool enabling SUBSTed drives be persistent between rebooting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.