Batch EXIT followed by '|' - what is the purpose of this?

luis.espinal

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.

jeb

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Batch : For what is percentage followed by asterisk used?

From Dev

KVM what is the purpose of EXIT_QUALIFICATION

From Dev

For what purpose does "read" exit 1 when EOF is encountered?

From Dev

What is the purpose of having a boolean expression containing an exit code in this shell script?

From Dev

Vim: Exit (:wq) with trailing exclamation mark ! What's the purpose?

From Dev

What purpose does the brush serve at the exit point of a scanner?

From Dev

What is the purpose of using Select(x => x) in a Batch method?

From Dev

What is the purpose of .*\\?

From Dev

What is the purpose of "?"

From Dev

Specify exit code in batch exit

From Java

Docker, what is it and what is the purpose

From Dev

What is purpose of dispatch sync?

From Java

What is the purpose of Angular animations?

From Java

What is the purpose of using HKDF?

From Java

What is the purpose of std::launder?

From Dev

What is the purpose of MemoryCache in MVC?

From Dev

delphi: what the purpose of the icontent?

From Dev

what's the purpose of factories?

From Dev

What is the purpose of glClearDepth in OpenGL?

From Dev

What is the purpose of doOnNext(...) in RxJava

From Java

What is the purpose of VOLUME in Dockerfile

From Java

What is the purpose of nameof?

From Java

What is the purpose of the word 'self'?

From Dev

What is the purpose of the state monad?

From Dev

What is the purpose of NamedDomainObjectContainer in gradle?

From Java

What is the purpose and use of **kwargs?

From Java

What is the purpose of .PHONY in a Makefile?

From Dev

What is the purpose of sorted sets?

From Dev

What is the purpose of the <nav> tag