In bash scripts, we can find the exit status of individual commands, which are piped to each other.
e.g. in below pseudo code:
$ command1 | command2 | command3
The exit status of command1, command2 & command3 can be obtained in ${PIPESTATUS[0]}, ${PIPESTATUS[1]} & ${PIPESTATUS[2]} respectively.
Also, the exit status of last command (command3 in this case) can be obtained from $?.
In case of windows batch scripts, we can find the exit status of the last command with %ERRORLEVEL%. Thus I would say, nearest equivalent of $? in batch scripting is %ERRORLEVEL%.
What is the equivalent of PIPESTATUS in batch scripting? How to find the exit status of individual commands?