PowerShell 中文文本乱码时,先确认运行版本、文件实际编码和读取时指定的编码。Windows PowerShell 5.1 的 -Encoding UTF8 写入带 BOM 的 UTF-8,而 PowerShell 7 的 utf8 默认不带 BOM;同样的命令文字,在两个版本中可能生成不同字节。

- 阅读全文 -