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?)