What does this "subst" invocation do?

1k views Asked by At

I would like to know what this command does in a batch script:

subst Q: /D  1>nul  2>nul
2

There are 2 answers

2
Keith Flower On

That looks like a DOS command (not bash).

subst substitutes a folder for a drive letter or substitutes one drive letter for another

The /D deletes (actually unmounts) a virtual (previously substituted) drive. So your command basically removes the virtual drive Q:

The 1>nul and 2>nul just get rid of the output (ie sends the standard output and standard error output to the nul device).

0
Wouter On

The subst command you are talking about is a DOS command, not bash.

What it does, is that it unmounts the virtual drive Q:, and the 1 > nul 2 > nul basically means that all output from the command is discarded.