I've never been one to really learn Windows/DOS Batch, but sometimes I dive into it to get some work done. I've seen the following construct in some legacy batch scripts, that I don't quite understand its intended function:
EXIT | some_external_command
What is the purpose of that? Maybe I'm missing something idiosyncratic (and yet vital/fundamental) of Windows Batch scripting.
Obviously A|B
causes to execute A
and to send its output to B
.
But in this example, EXIT
produces no output. As far as I can tell, it is equivalent to simply running the command on the right side of the '|' with no loss in function.
Is this construct intended to introduce some side effect that I'm not aware of? Just curious. Thanks.
It depends on the programB.
See the difference for
EXIT | set /p .=abc
set /p .=abc
EXIT
is used here to produce an empty input stream, this could also be done with other commands, like CD
or BREAK
.
This can be useful, if the program waits for input.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments