I have problem calling SUBST from a Windows batch file. I want to use one batch to create a virtual drive mapping and a second batch to unmount the drive. However unmounting gives the error message:
The system cannot find the path specified.
Here are my batch files:
prepare.bat
pushd .
subst X: .
X:
cleanup.bat
popd
subst X: /D
Execution give the following outputs:
d:\>prepare.bat
d:\>pushd .
d:\>subst X: .
d:\>X:
X:\>cleanup.bat
X:\>popd
d:\>subst X: /D
Das System kann den angegebenen Pfad nicht finden.
d:\>
Can anyone explain to me what is going wrong here and how to fix it?
EDIT:
Some strange things to notice:
- Typing all commands directly to the console works. Only when using batch files, the error occurs.
- Directly before calling
subst X: /D
the drive mapping is fine. Directly after calling it, the drive mapping has indeed been removed. Yet why do I get an error?