Share via


Changing text encodings of output files redirected from PowerShell.

I created a logman setting file as follows:
typeperf -q | where { $_ -like "\Phy*" } | foreach { '"' + $_.Trim() + '"' } > counter.txt

But, logman raised an error reading “Invalid counter path” when I tried to update a counter data collection with the settng file, counter.txt. That’s right. Logman requires the ANSI encoding for its setting file, while the output redirection that PowerShell created Unicode files for that redirection.

Then, How to create a output text file with different encodings?

typeperf -q | where { $_ -like "\Phy*" } | foreach { '"' + $_.Trim() + '"' } | output –encoding ASCII

Comments