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回車啓動