I have a local running PHP script in which I do this
exec('subst T: C:\\Development');
but in case T: is already mapped or subst' to some other location I want to unmap it first. so I do this
exec('net use T: /DELETE /y'); exec('subst T: /D');
but when T: is not mapped the exec net use will print an error to the console, and when it is mapped but not subst' the exec subst will print an error to the console. I want to have clean output in the console window, so no error when I try to unmap a drive that isn't mapped. the problem is I have absolutely no clue how to go about this.. can I suppress printing of the error message? if not, how do I run the commands only if the drive is mapped? then, coincidentally, how do I know if I should do net use /d or subst /d?
preguntado el 28 de agosto de 12 a las 13:08
> NUL after each command to pipe their output into...nowhere.
exec('net use T: /DELETE /y > NUL');