Reputation: 1399
What is "|" symbol used for in batch?
Because its not a command I cant use | /?
to find out what it does, and if I have something like Stackoverflow|Stackoverflow
(as an example) I'm told "stackoverflow is not a recognized as an internal or external command, operable program or batch file"
Upvotes: 1
Views: 188
Reputation: 75130
The pipe operator |
directs (pipes) the output of the first command to the standard input of the second command. So running
somecmd | anothercmd
Would first run somecmd
, then gather the output of somecmd
and run anothercmd
, giving it the output of somecmd
as input. You can read about it in innumerable places, just google "pipe command line" or something like it.
Upvotes: 3
Reputation: 3006
This character is used to chain commands.
There's a lot of documentation available on this. Wikipedia is probably a good place to start.
Upvotes: 1
Reputation: 141638
It's the pipe operator, or redirect operator. From TechNet:
Reads the output from one command and writes it to the input of another command. Also known as a pipe.
The pipe operator (|) takes the output (by default, STDOUT) of one command and directs it into the input (by default, STDIN) of another command. For example, the following command sorts a directory:
dir | sort
In this example, both commands start simultaneously, but then the sort command pauses until it receives the dir command's output. The sort command uses the dir command's output as its input, and then sends its output to handle 1 (that is, STDOUT).
Upvotes: 4