- 1 year ago
Why does a rem impact a code block that has its output piped?
Comment
1 / 1
When you use rem
in a code block that has its output piped, it will remove the output of that line from the pipeline. This is because rem
is used to create a comment in the batch file, and comments are not included in the output.
For example, consider the following command:
bashecho "Hello" & rem World
This command will output only "Hello", and "World" will not be included in the output because it is a comment.
If you want to include the output of a line that has a rem
command in a pipeline, you can use the echo
command to output the comment as well:
bashecho "Hello" & echo rem World | some-command
This will output both "Hello" and "rem World" to the pipeline.