How can I remove empty lines from wmic output? How can I remove empty lines from wmic output? windows windows

How can I remove empty lines from wmic output?


Like this:

for /f "skip=1 delims=" %A in (  'wmic path win32_service where "name like 'TeamViewer%'" get pathname ^| findstr /r /v "^$"') do set POSITION=%A

The findstr /r /v "^$" removes empty lines from the output.


wmic blah /value | find "=" >> wherever

output will be

field=value

no extra lines

tokenize from there, delim =