Reputation: 244
Hello stackoverflow users!
I'm not really new to batch. I just never used pipes |
in batch and even after I read reference on ss64.com I don't understand what's the pipe used for.
At first I thought it is OR operator or something (obviously I know now it's not).
I only know that it's located between two lines (commands) like &
, but I still don't get what it does exactly, and how it is used practically in code.
Thanks for answering!
Upvotes: 7
Views: 19986
Reputation: 9545
Pipe [|]: Redirect standard output of commandA to standard input of commandB
http://www.robvanderwoude.com/redirection.php
example :
echo KKZiomek | find "KKZ"
will redirect the echo KKZiomek
in the input of the FIND
and be used as second parameter of it.
Like well commented by @aschipfl the space is piped too. so better use :
echo KKZiomek| find "KKZ"
Upvotes: 12
Reputation: 14304
The pipe is used to send the output of one command to the input of another command.
For example, del /p
will ask for confirmation when you delete files. However, you can pipe echo y
to it to send a y
to the del command and del
will act as if the user had pressed y
.
Upvotes: 6