powershell美化

安装choco

管理员身份打开powershell,执行以下命令,遇到询问按Y

1
2
3
4
$ Set-ExecutionPolicy Bypass


$ Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

输入choco查看是否成功安装

安装ConEmu

1
2
$ choco install ConEmu
$ choco install microsoft-windows-terminal

安装 posh-git

1
Install-Module posh-git -Scope CurrentUser

安装oh-my-posh

1
2
3
Install-Module oh-my-posh -Scope CurrentUser
Set-Prompt
Set-Theme Agnoster

在powershell上运行需要的依赖

1
Install-Module -Name PSReadLine -AllowPrerelease -Scope CurrentUser -Force -SkipPublisherCheck

通过编辑配置文件启动引擎

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

添加以下代码到配置文件中

1
2
3
Import-Module posh-git
Import-Module oh-my-posh
Set-Theme Paradox

安装fluent-terminal

1
choco install fluent-terminal

然后打开terminal,点击设置-配置文件powershell设为默认即可

将fluent-terminal添加到右键菜单

1
2
3
reg add "HKCU\Software\Classes\Directory\shell\Open Fluent Terminal here\command" /d "\"%LOCALAPPDATA%\Microsoft\WindowsApps\flute.exe\" new \"%%1\"" /f
reg add "HKCU\Software\Classes\Directory\Background\shell\Open Fluent Terminal here\command" /d "\"%LOCALAPPDATA%\Microsoft\WindowsApps\flute.exe\" new \"%%V\"" /f
reg add "HKCU\Software\Classes\LibraryFolder\Background\shell\Open Fluent Terminal here\command" /d "\"%LOCALAPPDATA%\Microsoft\WindowsApps\flute.exe\" new \"%%V\"" /f

改以上内容为.bat后缀,然后双击运行即可

此操作添加到右键菜单时,没有图标,可以通过以下方式来添加自定义图标

添加自定义图标

运行regedit,地址栏输入

1
计算机\HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\Open Fluent Terminal here

右键新建字符串值,重命名为Icon,值填ico格式的图标图片,可以时间自定义图标

效果图

自己用的配置

将下列代码保存到记事本里,然后改名为Monokai.flutecolors,用fluent-terminal 导入即可

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{
"EncodedImage": "",
"Name": "Monokai",
"Author": "gufufu",
"Colors": {
"Foreground": "#D3F8E2",
"Background": "#000000",
"Cursor": "#D3F8E2",
"CursorAccent": "#3D3D3D",
"Selection": "rgba(134, 207, 206, 0.33984375)",
"SelectionForeground": null,
"SelectionBackground": null,
"Black": "#2E3436",
"Red": "#CB064D",
"Green": "#8DD006",
"Yellow": "#E6DB74",
"Blue": "#0376DD",
"Magenta": "#9D74E6",
"Cyan": "#52AEBF",
"White": "#F8F8F2",
"BrightBlack": "#555753",
"BrightRed": "#F92672",
"BrightGreen": "#A6E22E",
"BrightYellow": "#FED330",
"BrightBlue": "#0383F5",
"BrightMagenta": "#AE81FF",
"BrightCyan": "#66D9EF",
"BrightWhite": "#F8F8F0"
},
"BackgroundImage": null
}

本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!