Every program has three open
"File Handles" by default [stdin -> #0 connected to keyboard, stdout -> #1 | stderr -> #2 connected to terminal | display]
when chkdsk asks a question it does so by printing it on the
stdout and waiting for an answer on the
stdin
the pipe ( | ) connects the stdout of one program to the stdin of another ex -
command 1 | command 2 -> this connects the stdout of command 1 to the stdin of command 2
echo y|chkdsk c: /f/r
so the stdout of echo [ echo y ] which is connected to the stdin of chkdsk is used to fulfill the request of yes or no