Windows cmd pass output of one command as parameter to another
There is no $
operator in cmd
.
Redirection operators (<
, >
, >>
) expect files or stream handles.
A pipe |
passes the standard output of a command into the standard input of another one.
A for /F
loop however is capable of capturing the output of a command and providing it in a variable reference (%A
in the example); see the following code:
for /F "usebackq delims=" %A in (`git status -s -b ^| sed -n '2p' ^| cut -d' ' -f2-`) do git diff %A