Windows Terminal终端是Win10新版终端,比原版cmd强大很多,具体表现在个性化界面的优化。
Windows Terminal是Win10 Microsoft Store中的应用,目前商店中显示的信息还不是正式版【preview】
安装
打开windows自带的应用商店
搜索Windows Terminal
点击安装
下载后可以在应用中找到,点击进入可以进入使用,默认开启的首页是powershell
windows terminal可以在同一窗口代开多个标签页
个性化配置
每个标签页都可以任意配置应用,刚安装好后应该默认只有三个程序的terminal选择,分别是powershell,cmd,和azure cloud shell。
可以根据需要加入如anaconda,Git bash,ssh,Ubuntu等terminal,并且已有的terminal也可以根据喜好配置。
点击上方下拉菜单里的setting,会出现配置文件;
我的配置如下,每个选项都有对应配置的功能:
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"profiles":
{
"defaults":/*全局配置*/
{
// Put settings here that you want to apply to all profiles
// 默认打开的 Profile GUID(下面会详细介绍)
"defaultProfile": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
// 终端窗口默认大小
"initialCols": 120,
"initialRows": 30,
// 亮色或暗色主题,可选值 "light", "dark", "system"
"requestedTheme": "system",
// 合并标题栏和标签栏
"showTabsInTitlebar": true,
// 如果 showTabsInTitlebar 与本值同为 false 时,自动隐藏标签栏
"alwaysShowTabs": true,
// 在标题栏上显示当前活动标签页的标题
"showTerminalTitleInTitlebar": true,
// 双击选择时用于分词的字符
"wordDelimiters": " /\()"'-.,:;<>~!@#$%^&*|+=[]{}~?u2502",
// 选择时复制到剪贴板
"copyOnSelect": true,
// ...
},
"list":/*每种类型terminal的详细配置*/
[
{
// Make changes here to the cmd.exe profile 关于cmd的配置
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
/*网页搜索guid生成可以获得每个程序唯一的guid,visual studio内的工具也有生成guid的功能*/
"name": "cmd",
"commandline": "cmd.exe",
/*程序位置*/
"hidden": false,
"tabTitle" : "cmd",/*名称*/
"foreground" : "#DCDCDC",/*字体颜色*/
"icon" : "D:/KuroNekoNano_blog/themes/hexo-theme-matery/source/favicon.png",/*ICO图标*/
"backgroundImage" : "D:/图片整理/3440x1440 (41).jpg",/*终端背景图*/
"acrylicOpacity" : 0.75,
/*亚克力透明效果*/
"backgroundImageOpacity" : 0.25,
/*背景透明度*/
"backgroundImageStretchMode" : "fill",
"closeOnExit" : true,
"colorScheme" : "Campbell",
"cursorColor" : "#FFFFFF",
"cursorShape" : "bar",
"fontFace" : "Consolas",
"fontSize" : 11,
"historySize" : 9001,
"padding" : "0, 0, 0, 0",
"snapOnInput" : true,
"startingDirectory" : "%USERPROFILE%",
"useAcrylic" : true
},
{
// Make changes here to the Anaconda Prompt profile 关于anaconda的配置
"guid": "{FCAD2812-51E4-4E55-96AF-2F2B75628FE0}",
"name": "anaconda prompt",
"commandline": "%windir%\System32\cmd.exe /K D:\Users\KuroNeko\Anaconda3\Scripts\activate.bat",
"hidden": false,
"tabTitle" : "Anaconda Prompt",/*名称*/
"foreground" : "#DCDCDC",/*字体颜色*/
"icon" : "D:/Users/KuroNeko/Anaconda3/Menu/anaconda-navigator.ico",/*ICO图标*/
"backgroundImage" : "D:/图片整理/3440x1440 (46).jpg",/*终端背景图*/
"acrylicOpacity" : 0.75,
"backgroundImageOpacity" : 0.25,
"backgroundImageStretchMode" : "fill",
"closeOnExit" : true,
"colorScheme" : "Campbell",
"cursorColor" : "#FFFFFF",
"cursorShape" : "bar",
"fontFace" : "Consolas",
"fontSize" : 11,
"historySize" : 9001,
"padding" : "0, 0, 0, 0",
"snapOnInput" : true,
"startingDirectory" : "%USERPROFILE%",
"useAcrylic" : true
},
{
// Make changes here to the Git Bash profile 关于Git bash的配置
"guid": "{4B25BFD9-4962-49AE-8512-BBD336462BAB}",
"name": "Git Bash",
"commandline": "D:\Program Files (x86)\Git\bin\bash.exe",
"hidden": false,
"tabTitle" : "Git Bash",/*名称*/
"foreground" : "#DCDCDC",/*字体颜色*/
"icon" : "D:/图片整理/2019-07-02-10-22-00.png",/*ICO图标*/
"backgroundImage" : "D:/图片整理/Screenshot_20180615-013342.png",/*终端背景图*/
"acrylicOpacity" : 0.75,
"backgroundImageOpacity" : 0.25,
"backgroundImageStretchMode" : "fill",
"closeOnExit" : true,
"colorScheme" : "Campbell",
"cursorColor" : "#FFFFFF",
"cursorShape" : "bar",
"fontFace" : "Consolas",
"fontSize" : 11,
"historySize" : 9001,
"padding" : "0, 0, 0, 0",
"snapOnInput" : true,
"startingDirectory" : "%USERPROFILE%",
"useAcrylic" : true
},
{
// Make changes here to the powershell.exe profile
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
"hidden": false,
"tabTitle" : "PowerShell",
"foreground" : "#DCDCDC",
"icon" : "D:/图片整理/%23C[KC]AMNLO31Q~N{$UVS.png",
"backgroundImage" : "D:/图片整理/3440x1440 (44).jpg",
"acrylicOpacity" : 0.4,
"backgroundImageOpacity" : 0.6,
"backgroundImageStretchMode" : "fill",
"colorScheme" : "Campbell",
"cursorColor" : "#FFFFFF",
"cursorShape" : "bar",
"fontFace" : "Consolas",
"fontSize" : 11,
"historySize" : 9001,
"padding" : "0, 0, 0, 0",
"snapOnInput" : true,
"startingDirectory" : "%USERPROFILE%",
"useAcrylic" : true
},
{
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
"hidden": false,
"name": "Azure Cloud Shell",
"source": "Windows.Terminal.Azure"
}
]
},
// Add custom color schemes to this array
"schemes": [],
// Add any keybinding overrides to this array.
// To unbind a default keybinding, set the command to "unbound"
"keybindings": []
}
配置项的功能说明:
"profiles":
[
{
// 每个 Profile 的唯一标识符,生成方法见下
"guid": "{e1e1ac58-02c1-456a-a857-01149673a65d}",
// 设置为 true 即可在新建菜单中隐藏
"hidden": false,
// 名字,会显示在菜单中
"name": "Ubuntu",
// 启动命令行
"commandline": "wsl.exe",
// 启动目录
"startingDirectory": "%USERPROFILE%",
// 字体设置
"fontFace": "Consolas",
"fontSize": 11,
// 背景亚克力透明效果(窗口失去焦点时无效)
"useAcrylic": true,
"acrylicOpacity": 0.5,
// 背景图片
// "backgroundImage" : "X:\assets\background.png",
// "backgroundImageOpacity" : 0.5,
// "backgroundImageStretchMode" : "uniformToFill",
// 菜单与标签中显示的图标
"icon": "X:\assets\UbuntuLogo.scale-100.png",
// 配色方案,见下
"colorScheme": "Atom",
// 光标颜色
"cursorColor": "#FFFFFF",
// 光标类型,可选值 "vintage" ( ▃ ), "bar" ( ┃ ), "underscore" ( ▁ ), "filledBox" ( █ ), "emptyBox" ( ▯ )
"cursorShape": "underscore"
// ... 其他配置请参见官方文档
}
]
可选配色方案:
"schemes": [
{
"name": "Atom",
"black": "#000000",
"red": "#fd5ff1",
"green": "#87c38a",
"yellow": "#ffd7b1",
"blue": "#85befd",
"purple": "#b9b6fc",
"cyan": "#85befd",
"white": "#e0e0e0",
"brightBlack": "#000000",
"brightRed": "#fd5ff1",
"brightGreen": "#94fa36",
"brightYellow": "#f5ffa8",
"brightBlue": "#96cbfe",
"brightPurple": "#b9b6fc",
"brightCyan": "#85befd",
"brightWhite": "#e0e0e0",
"background": "#161719",
"foreground": "#c5c8c6"
}
],
配置环境变量
根据需要可以方便的通过win+R快捷键打开windows terminal终端。
环境配置步骤
右键【此电脑】,点击【属性】,打开左边的【高级系统配置】
点击【高级】选项卡,打开【环境变量】
打开【新建用户变量】,内容如下所示
变量名为运行的命令值,自由配置
变量值为windows terminal的程序路径
【注意变量值应依据每个人不同的用户名或是程序路径来配置,比如我的用户名为KuroNeko】
使用方法为win+R后输入wt回车启动