13

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?

Sathyajith Bhat
  • 61,504
  • 38
  • 179
  • 264
Dan
  • 225
  • 1
  • 3
  • 9
  • i've never used subst myself, but [this](http://en.wikipedia.org/wiki/Subst#Persisting_across_reboots) is what Wikipedia has to say on setting up a persistent mapping. hope it helps – Xantec Dec 02 '10 at 14:03
  • @Dan, Here: [How to make SUBST mapping persistent across reboots?](http://superuser.com/q/29072/78897) .. – 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 02 '18 at 14:12

4 Answers4

21

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.

Gaff
  • 18,569
  • 15
  • 57
  • 68
MarianoC
  • 219
  • 2
  • 2
16

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
Hank
  • 176
  • 1
  • 2
1

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

cyberponk
  • 211
  • 2
  • 5
1

https://github.com/ildar-shaimordanov/psubst

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

jsxt
  • 121
  • 3