推荐一款命令行利器 Windows Terminal (附安装教程,自定义超炫界面)

简介

    微软最近在 Build 2019 开发者大会上发布了一款引人注目的全新的命令行应用程序 —— Windows 终端,一款全新且功能超级强大的终端应用程序,适用于命令行工具和命令提示符,PowerShell和WSL等Shell用户。



Windows Terminal 主要功能特性

    Windows Terminal 包含很多社区呼声很高的特性,比如:多标签页支持、富文本、多语言支持、窗口分割、可配置、主题和样式,支持 emoji 和基于 GPU 显卡加速的文本渲染等等。

    很多博文有介绍怎么使用,或者夸赞或者贬义,重在使用,那么我们先来体验一下,这才是重点。


    应用商店搜索 Windows Terminal,点击获取,这里注意,系统需要1903版本以上的才能安装。




    安装好了之后,默认打开是这个界面。



    现在开始实现之前他们吹牛逼的事情,,点击选项卡旁边的下拉,会出现以下几个选项(powershell和cmd是会有的,其他看自己是否添加)如下图所示,选择settings将会打开profiles.json (https://aka.ms/terminal-profiles-schema)也就是配置文件,需要注意的是,好像只能用visual studio打开,我用的是visual studio 2017。



    配置文件可以对windows terminal进行各种属性的调整,点击About -Documentation (https://github.com/microsoft/terminal/blob/master/doc/user-docs/UsingJsonSettings.md)可以查看具体描述。



globals(全局属性)
profiles(配置文件,列出了每一项的属性配置)
schemes(配色方案)


重点来了,接下来我试着配色,代码如下:


"profiles": [  {    //powershell    "acrylicOpacity": 0.5,    "backgroundImage""C:/Users/Pictures/520.jpg",    "backgroundImageOpacity": 0.5,    "backgroundImageStretchMode": "fill",    "colorScheme": "Campbell",    "commandline": "powershell.exe",    "cursorColor": "#FFFFFF",    "cursorShape": "bar",    "fontFace": "Consolas",    "fontSize": 11,    "foreground": "#00FF00",    "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",    "historySize": 9001,    "icon": "ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png",    "name": "Windows PowerShell",    "padding": "0, 0, 0, 0",    "snapOnInput": true,    "startingDirectory": "%USERPROFILE%",    "tabTitle": "powershell",    "useAcrylic": true  },  {    //cmd    "acrylicOpacity": 0.75,    "backgroundImage""C:/Users/Pictures/521.jpg",    "backgroundImageOpacity": 0.5,    "backgroundImageStretchMode": "fill",    "closeOnExit": true,    "colorScheme": "Campbell",    "commandline": "cmd.exe",    "cursorColor": "#FFFFFF",    "cursorShape": "bar",    "fontFace": "Consolas",    "fontSize": 11,    "foreground": "#00FF00",    "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",    "historySize": 9001,    "icon": "ms-appx:///ProfileIcons/{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.png",    "name": "cmd",    "padding": "0, 0, 0, 0",    "snapOnInput": true,    "startingDirectory": "%USERPROFILE%",    "tabTitle": "cmd",    "useAcrylic": true  },  {    "acrylicOpacity": 0.59999999999999998,    "closeOnExit": false,    "colorScheme": "Vintage",    "commandline": "Azure",    "connectionType": "{d9fcfdfa-a479-412c-83b7-c5640e61cd62}",    "cursorColor": "#FFFFFF",    "cursorShape": "bar",    "fontFace": "Consolas",    "fontSize": 10,    "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",    "historySize": 9001,    "icon": "ms-appx:///ProfileIcons/{b453ae62-4e3d-5e58-b989-0a998ec441b8}.png",    "name": "Azure Cloud Shell",    "padding": "0, 0, 0, 0",    "snapOnInput": true,    "startingDirectory": "%USERPROFILE%",    "useAcrylic": true  }}


最后效果图就如下啦:




技巧和窍门:

1、在PowerShell中,可以通过检查环境变量WT_SESSION的存在来发现是否正在使用Windows终端。

2、在pwsh下,您还可以使用(Get-Process -Id $ pid).Parent.Parent.ProcessName -eq'WindowsTerminal'

可以通过按住Ctrl并用鼠标滚动来更改终端缩放。

3、如果在profiles.json中启用了useAcrylic,则可以通过按住Ctrl + Shift并用鼠标滚动来更改背景不透明度。


Github

https://github.com/microsoft/terminal


Build Guide

https://github.com/microsoft/terminal/issues/489#issue-441161390




推荐阅读

(点击标题可跳转阅读)

对程序员来说,一份工作坚持多久跳槽最合适?

吐槽吧,code monkey

程序员视角看手机计算器上为什么10%+10% != 0.2 

@程序员,说好不哭,你却哭的稀里哗啦

来瞅瞅 | 2019年最新编程语言排行榜

多大仇,这个离职证明大家怎么看?

从【微软员工主动曝光薪资】来反思国内薪资普遍现状

谷歌google浏览器chorme打不开怎么办呢