http://www.perlmonks.org?node_id=723299


in reply to Re^10: unpacking wmic command's unicode output
in thread unpacking wmic command's unicode output

As a solution, it's useless and therefore wrong.

Hm. That's a bit strong. As a solution, it produces the desired result. Ie. The data in the file is sans unicoding.

The fact that the -CS isn't actually responsible for that--nor even perl itself directly--doesn't detract from the usability of the solution to produce desired result.

As it turns out, wmic process | perl -pe1 > file also produces the desired result, and as its 3 characters shorter I guess that makes it a superiour solution. I would have suggested that; had I thought to have tried it.

It turns out that it just going via a pipe that causes wmic.exe to produce ansi output rather than unicode, so a simple wmic process | tee > file works.

And it's even shorter.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.