失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > Windows 终端美化 PowerShell 默认终端修改

Windows 终端美化 PowerShell 默认终端修改

时间:2023-08-31 09:51:47

相关推荐

Windows 终端美化 PowerShell 默认终端修改

Windows 终端美化 PowerShell 默认终端修改

安装 oh-my-posh安装Powerline字体安装ConEmu美化powershell设置ConEmu把界面默认语言改为中文简体设置默认启动shell为powershell设置powershell为默认shell

网上各种各样的美化方法操作起来十分麻烦

可以写好脚本完成配置

可以直接在microsoft store 中搜索PowerShell,完成基本的安装。

以下开始美化PowerShell。

所有的命令都是在管理员模式下执行

安装 oh-my-posh

首先确保安装git

Install-Module posh-git -Scope CurrentUser git

然后安装「oh-my-posh」

Install-Module oh-my-posh -Scope CurrentUser

弹出安装选项时,输入y或者a。

安装Powerline字体

安装方法要用到git。Win+X然后再按A,启动powershell管理员模式。执行代码:

# clonegit clone /powerline/fonts.git --depth=1# installcd fonts./install.ps1

安装ConEmu

ConEmu相当于windows终端的增强版,可以直接打开多种类型的控制台窗口,之后我们安装完了会用他替换powershell,没关系,调试好以后使用感觉一定比原版powershell好。

choco install ConEmu

美化powershell

接下来在「PowerShell」执行以下命令检测并初始化 「Profile」 文件(类似 「Linux bash」 中的.bashrc 文件)保存我们的配置:

if (!(Test-Path -Path $PROFILE )) {New-Item -Type File -Path $PROFILE -Force }

显示默认路径,我的路径是下面这样

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

然后双击箭头文件,或者输入

notepad $PROFILE

打开文件,将下面的内容粘贴进去

Import-Module posh-gitImport-Module oh-my-poshSet-Theme Agnoster

保存文件后,以管理员权限重新打开powershell,开始自动安装。

遇到选项选择y或者a。

如果报错

git command could not be found. Please create an alias or add it to your PATH.

请先安装Git for Windows

安装后即可解决

下载这个非常困难,国内下载地址:

/mirrors/git-for-windows/v2.26.0.windows.1/

设置ConEmu

设置很简单。打开ConEmu,右键上方栏位,选择setting:

把界面默认语言改为中文简体

设置默认启动shell为powershell

当然你也可以选择别的,例如管理员模式

设置powershell为默认shell

或者可以直接在安装powershell后执行脚本。

脚本下载链接

如果觉得《Windows 终端美化 PowerShell 默认终端修改》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。