I am trying to format the output of a command in JSON as such:
echo \"patches\" : {
set patches=\"wmic qfe get HotfixID\"
for /f \"skip=1\" %%i in (\' %patches%
WMIC
command output in batchThe simplest solution is to use findstr
to remove the blank lines:
for /f "skip=1" %%i in ('%patches% ^| findstr /r /v "^$"')
No extra for
loop required.