Unable to unmount "subst" drive
Solution 1
If you just type SUBST
by itself, no parameters, it will list all drive letters created by subst, e.g.
C:\>subst Z: C:\Windows
C:\>subst
Z:\: => C:\Windows
C:\>subst z: /D
C:\>subst
(blank)
map Z: to windows folder, show list of mappings, delete Z: mapping, show mappings again (none) So if you don't see it there, it wasn't created by subst.
Solution 2
May not be the problem the original user had, but it is one way I got into a tangle.
$ subst
I:\: => C:\Users\ME\Dropbox\Images
$ subst /D I:
Invalid parameter - D:/
$ subst I:\ /D
Invalid parameter - I: /D
$ subst I: /D
Path not found - D:/
Is the problem obvious yet? It's something simple:
$ which subst
/c/WINDOWS/system32/subst
Notice the path?! I was running subst in a Cygwin shell created by installing GitHub on Windows 10. The icons for the shells and the default colors are identical so I didn't notice - silly me. The "$" prompt should have been the clue (or the MINGW64 on the title bar).
subst is a Linux command by the way, completely different from Windows Subst.
Solution 3
You probably used subst
from an elevated command prompt. When that is done calling subst
from a normal command prompt doesn't return the mappings made in the elevated one.
Try calling subst
in an elevated commant prompt (start -> cmd -> ctrl+shift+enter or right click and Run as administrator
).
Solution 4
Try net use (as mousio suggests above). Today I had a similar problem with most drives taken by network connections and "net use * /d" was able to make the drive letters available.
D:\>net use
New connections will be remembered.
Status Local Remote Network
-------------------------------------------------------------------------------
Disconnected K: \\foo\scratch Microsoft Windows Network
...
Disconnected Z: \\foo\scratch Microsoft Windows Network
The command completed successfully.
D:\>net use * /d
Related videos on Youtube
Marcel
Updated on September 18, 2022Comments
-
Marcel almost 2 years
So I have this
G:
drive which I'm 99% sure I "mounted" usingsubst
to associate a folder with a drive letter. If I double click on it I see the contents ofC:\User\Marcel\Google Drive
.Anyway, now I want to get rid of it but I haven't had any luck doing so. I've tried running
subst G: /d
in both a regular and elevated command prompt, as well as trying to associate a new folder over top ofG:
and both times I gotInvalid parameter - G:
. It's also still there after a reboot which is weird becausesubst
isn't supposed to persist over reboots. I've also tried these things in Safe Mode and nothing is different.I've checked what runs on startup using CCleaner and there's nothing related in there either.
Any ideas on how to resolve this? See screenshot below of the oddity.
-
Kevin Versfeld over 11 yearsJust for giggles try a full power cycle reboot, it may/may not help.
-
Marcel over 11 years@mdpc I've had this problem for more than six months and have done about a dozen full power reboots since.
-
mousio over 11 yearsWhat does
net use
say (normal/elevated)? -
Marcel over 11 years@mousio
New connections will be remembered. There are no entries in the list.
for both normal and elevated.
-
-
mprill over 11 yearsCan you check if the source of that letter is the registry key
HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices
? -
Marcel over 11 yearsNope, there's several from
\DosDevices\B
through to\DosDevices\V
but no\DosDevices\G
. -
bertieb almost 9 yearsDoes this use the same process as the
subst
command the OP used? -
Jim Fell over 8 yearsI was also having a problem unmounting a
subst
drive. It turns out that the reverse of what you suggest is true as well. I had mounted it in a non-elevated command prompt and was trying to remove it in an elevated command prompt. Switching to a command prompt with the same lower privilege level fixed the problem. Kudos! -
Scott - Слава Україні almost 5 yearsOK, this is an amusing scenario. It’s probably not what happened to the OP in this question, but, yeah, sure, somebody who finds this question through a search might be in this situation. And, yes, there is an obscure Unix / Linux command called
subst
(which is completely unrelated to the Windows command calledsubst
). But so what? Clearly you were running the Windows version ofsubst
— why wasn’t it working? (P.S. I mapped a drive usingsubst
in Command Prompt, and then I was able to unmap it usingsubst g: /d
from Cygwin with no problem.)