1. 工具及教程
可直接参考第二部分汇总
-
powershell 美化教程:
https://blog.walterlv.com/post/beautify-powershell-like-zsh.html -
配置文件设置参考教程:
https://sspai.com/post/62167#! -
美化及配置文件参考:
https://www.cnblogs.com/Jingkunliu/p/14299332.html -
相关工具下载:
ColorTool
FluentTerminal
Sarasa Gothic / 更纱黑体 / 更紗黑體 / 更紗ゴシック 1
2. 汇总
# 管理员身份运行 powershell安装 posh-git 和 oh-my-posh
Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser
# 新增(或修改)你的 PowerShell 配置文件
# 如果之前没有配置文件,就新建一个 PowerShell 配置文件
if (!(Test-Path -Path $PROFILE )) { New-Item -Type File -Path $PROFILE -Force }
# 方法一:
# 用记事本打开配置文件
notepad $PROFILE
# 添加以下内容
Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt Paradox
# 方法二:
echo "Import-Module posh-git","Import-Module oh-my-posh","Set-PoshPrompt Paradox" > $PROFILE;
# 根据需要,设置终端英文环境
Set-Culture en-US
一般来说,PowerShell 的用户配置文件在
C:\Users\<用户名>\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
3. 相关报错解决
3.1 系统上禁止运行脚本
解决方法:
管理员身份打开powershell,执行:
get-executionpolicy
set-executionpolicy remotesigned
博主所知,目前唯一严格支持要求的字体(中文环境下)只有「Sarasa Gothic / 更纱黑体 / 更紗黑體 / 更紗ゴシック」 ↩︎