When used with .Net Framework 2.0 it looks like the OEM encoding isn't available in PowerShell.
PS1> Get-Content $FilePath -Encoding OEM
Cannot bind parameter 'Encoding'. Cannot convert value "OEM" to type "Microsoft.PowerShell.Commands.FileSystemCmdletProviderEncoding" due to invalid enumeration values. Specify one of the following enumeration values and try again. The possible enumeration values are "Unknown, String, Unicode, Byte, BigEndianUnicode, UTF8, UTF7, Ascii".
However I have files in this encoding that I'd like to read in a string, how to do it?
FileSystemCmdletProviderEncoding
enumeration. I note this includesOem
: maybe case is important (or PowerShell version). – Richardget-help get-content -param encoding
is smaller than in the enumeration. – RichardOem
encoding value directly; the - excellent - workaround below is only needed in v2. – mklement0