17/04/2020

[Windows] Store command output in variable in batch script

For whatever reason, storing the output of a command into a variable from a batch script is not easy at all:

FOR /F "tokens=*" %%g IN ('your_command ^| with_escaped_pipe_if_you_need_it') do (SET VAR=%%g)

No comments:

Post a Comment

With great power comes great responsibility