Quantcast
Channel: Active questions tagged utf-8 - Stack Overflow
Viewing all articles
Browse latest Browse all 1052

WMIC command in batch outputting non UTF-8 text files

$
0
0

I'm using a WMIC command to output a list of SIDS and accompanying user profile names to text. From the text, I can edit a list of SIDS I need to add a set of registry keys to. However, the script that loops through the edited text file of SIDS is encoded in a format the script doesn't pick up and just fails to run. Using notepad++ I can re-encode from UCS-2 LE BOM to UTF-8 and then I can complete the script hassle free.

How can I make the output from the WMIC text default to UTF-8?.

I noticed this on more that one PC. To cure the problem, as mentioned, I can re-encode in notepad++ but its a step I really need to avoid if possible. Trying to automate things as much as I can. The sole issue is the encoding, all other scripts, commands, codes etc. are fine once I get a UTF-8 text file. I use batch file often and like to output to text files, looking at those they are all defaulting to UTF-8 as expected. Seems specific to WMIC command here.

WMIC Path Win32_UserProfile Where "Special='False' And Not LocalPath='Null'" Get LocalPath,SID>somefile.txt

Gives all the info I need but outputs to UCS-2 LE BOM, not UTF-8

Any assistance would be great, thanks.(was thinking maybe a reg query would bypass the issue?)


Viewing all articles
Browse latest Browse all 1052

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>