windows powershell7.X安装,跟oh-my-posh美化

在windows安装powershell7.x,以及oh-my-posh的美化 1.安装Windows Terminal 有下面几种安装方式 直接在windows的商店重搜索windows terminal然后安装即可 通过winget安装 winget install --id=Microsoft.WindowsTerminal -e 通过Chocolatey安装 choco install microsoft-windows-terminal 2.安装powershell7 可以通过下面几种方式安装 在官网下载msi安装包,直接安装 https://learn.microsoft.com/zh-cn/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.2 如下图 使用 winget 安装 winget install --id Microsoft.Powershell --source winget 设置默认启动的shell为powershell7 打开windows terminal 在窗口标题栏右键,然后点击设置 然后选择启动,然后选择默认用powershell7启动,如下图 然后关闭windows terminal,重新打开,就可以看到默认是以powershell启动 3.安装oh-my-posh[顺带安装posh-git] 安装oh-my-posh和posh-git 旧教程都是通过在powershell中安装模块的方式安装,但是作者现在已经不推荐那样安装了,具体的原因在这里:原因 新的oh-my-posh的安装方式,也在原因有说明,过程如下: oh-my-posh 首先移除掉之前的一些模块缓存文件 Remove-Item $env:POSH_PATH -Force -Recurse :exclamation: 注意 如果你在这个位置有放自己的一些内容,这些内容会一起被删除,所以在执行上面的命令之前,请一定要记得先保存这些自己的文件 安装oh-my-posh winget install JanDeDobbeleer.OhMyPosh -s winget 这个命令会做下面两件事: 安装 oh-my-posh.exe可执行文件到你的电脑 安装Oh My Posh的最新的主题【如果你有设置自定义的主题,就会使用你自己的】 3. 卸载powershell中的oh-my-posh模块 Uninstall-Module oh-my-posh -AllVersions 从$PROFILE中删掉下面的模块导入命令 Import-Module oh-my-posh posh-git...

October 15, 2022 · 1 min · 191 words · Link