I am not a bro in batch scripts, but i can adapt.
I am trying to make a batch file that will check the firewall state, and toggle it(ON/OFF).
Note: [the output of the command contain ON or OFF in it's output alongside with other strings].
set "result=" netsh advfirewall show allprofiles state
IF not x%result:ON=%==x%result% (
::Disable Firewall
NetSh Advfirewall set allprofiles state off
) ELSE (
::Enable Firewall
NetSh Advfirewall set allprofiles state on
)
the problem as you see the result variable only contain the last line of the command output, so how to store the multi-line output of the command in a variable without having to store the command's output in a file as it seems redundant.