记录一下Windows解决codex中文乱码&Windows安装PowerShell7

2026-04-13 12:370阅读0评论SEO基础
  • 内容介绍
  • 文章标签
  • 相关推荐
问题描述:

最近电脑重装了win11系统,忘记了codex还有中文乱码问题,之前使用的方案是修改系统设置,改编码为utf-8。这个方案一直认为不太好,正好这次改成PowerShell7。顺便记录一下,方便下次配置。

  1. 安装PowerShell7

winget install --id Microsoft.PowerShell -e

验证:

pwsh -v


  1. 设置utf-8编码

打开PowerShell 7,执行:

notepad $PROFILE

如果提示不存在:

New-Item -Type File -Path $PROFILE -Force notepad $PROFILE

在文件中写入以下内容:

$OutputEncoding = [Console]::InputEncoding = [Console]::OutputEncoding = New-Object System.Text.UTF8Encoding $PSDefaultParameterValues['*:Encoding'] = 'UTF8'

保存后重启

一个小疑问 :
image845×693 49.4 KB


  1. 设置Codex使用PS7

– cli中直接使用PS7即可。

阅读全文
问题描述:

最近电脑重装了win11系统,忘记了codex还有中文乱码问题,之前使用的方案是修改系统设置,改编码为utf-8。这个方案一直认为不太好,正好这次改成PowerShell7。顺便记录一下,方便下次配置。

  1. 安装PowerShell7

winget install --id Microsoft.PowerShell -e

验证:

pwsh -v


  1. 设置utf-8编码

打开PowerShell 7,执行:

notepad $PROFILE

如果提示不存在:

New-Item -Type File -Path $PROFILE -Force notepad $PROFILE

在文件中写入以下内容:

$OutputEncoding = [Console]::InputEncoding = [Console]::OutputEncoding = New-Object System.Text.UTF8Encoding $PSDefaultParameterValues['*:Encoding'] = 'UTF8'

保存后重启

一个小疑问 :
image845×693 49.4 KB


  1. 设置Codex使用PS7

– cli中直接使用PS7即可。

阅读全文