Powershell: Get default system encoding

2019-06-15 01:47发布

The powershell cmdlet out-file has the switch -encoding witch you can set to default. This default value will use the encoding of the system's current ANSI code page.
My question is: How can I get the name of this default encoding that out-file will use with powershell?

1条回答
我欲成王,谁敢阻挡
2楼-- · 2019-06-15 02:16

Take a look at [System.Text.Encoding]::Default, I believe it is used as "default".

E.g. in my case:

[System.Text.Encoding]::Default.EncodingName

gets

Cyrillic (Windows)
查看更多
登录 后发表回答