I am trying to parse the output of a WMIC command, but I noticed, when I redirect the output to a file, the string goes in with one readable character and one NUL character (0x00 according hex editor), making the output unusable for my purpose.
I want to parse this WMIC output by reading it one character at a time and discard the non-readable characters, at the end reconstructing the string as a continuous characters without weird spaces in between them.
How can I accomplish this in DOS (actually CMD prompt under win-7) batch file ?
My command
wmic process where processID=12345 get commandLine
Output directed to a file looks like this
_C o m m a n d L i n e
n o t e p a d q . b a t
And I want it to look like
_Command Line
notepad q.bat
I don't know how I can accomplish this, so I am not even going to feign what I am doing. My batch programming skills nearly non-existent.