Win10 命令行美化笔记
对win10自带的Power Shell进行美化,目标:
- 不需要单独启动(
Fluent Terminal等),能与原生的Power Shell完美契合。 - 比较美观,符合主流审美,高亮、提示功能友好。原生的
Power Shell在处理命令行的参数时字体颜色偏暗。 
主要工具
- Scoop:windows 系统中的包管理工具,可用于下载 
ConEmu。 - ConEmu:命令行客户端,可设置为替代原生的
Power Shell,符合第一点目标。 - oh-my-posh:
ConEmu中Power Shell提示的主题功能。 - Power Line 字体:用于替换原生命令行的字体,并增加扩充字体图标库。
 - Git:用于从码云下载 Power Line 字体
 
具体操作
安装 Scoop:
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')安装 ConEmu:
scoop install ConEmu
安装以及配置 oh-my-push:
Install-Module posh-git -Scope CurrentUser Install-Module oh-my-posh -Scope CurrentUser
中途会要求确认:
- 安装导入 
NuGet:y - 从 
PSGallery安装模块:a 
初始化以及配置:
# 默认设置 Set-Prompt # 设置配色主题 Set-Theme Agnoster
修改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-Theme Agnoster(这里可以是任意配色主题)
其他相关配置以及所有可用主题可参考 https://github.com/JanDeDobbeleer/oh-my-posh#configuration 。
- 安装导入 
 安装 Power Line 字体:
git clone https://github.com/powerline/fonts.git --depth=1 cd fonts ./install.ps1
安装完后,可以删了这个文件夹。
配置 ConEmu:
打开 ConEmu,在
标题栏-右键-settings进入设置界面。- 修改语言:
通用-Interface language选择zh: 简体中文 - 修改字体:
通用-字体-控制台主要字体选择Meslo LG M Regular for Powerline Nerd Font - 修改字符集:
通用-字体-Unicode 范围选择Dashes and Borders: 2013-2015;2500-25C4; - 修改默认shell:
启动-任务-预定义的任务-{Shells::PowerShell(Admin)}右侧勾选默认shell - 替换默认 PowerShell :
集成-默认终端右侧勾选强制使用ConEmu作为控制台的默认终端、在系统启动时注册 - 修改主题配色: 
通用-Choose color scheme选择Babun - 设置多窗口运行:
通用-外观取消勾选单例模式, 标题栏设置不隐藏,在通用-标签栏中设置不要显示,在功能特性-状态栏取消勾选显示状态栏 
以上配置文件信息(保存在
xml文件中,可以直接导入):Github:ConEmu-settings- 修改语言:
 

京公网安备 11010502036488号