跳至主要內容

powershell

chanchaw小于 1 分钟windows

解决乱码

  1. 配置 git,告诉它应该如何输出中文
git config --global core.quotepath false
git config --global gui.encoding utf-8
git config --global i18n.commit.encoding utf-8
git config --global i18n.logoutputencoding utf-8
  1. 以管理员身份打开 powershell 执行命令 chcp 65001
  2. powershell 中执行下面命令:先检查是否有配置文件,如果没有则创建并打开
if (!(Test-Path $PROFILE)) { New-Item -Path $PROFILE -ItemType File -Force }
notepad $PROFILE

拷贝下面代码到配置文件并保存

[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
  1. 重新打开 powershell 验证上面的配置是否生效