微软推出的Windows terminal可作为CMD的启动器并随心所欲配置主题,推荐
一、安装Windows terminal
Microsoft Store搜索Windows terminal
选择第一个安装即可,第二个为预览版
二、选择主题
Windows terminal有大量的主题可以选择,如果达不到您的要求,还可以自己进行配置
登陆如下网址,选择一个你喜欢的主题复制主题代码
https://atomcorp.github.io/themes/
三、配置主题
打开Windows terminalWin+R
运行,输入wt
点击Windows terminal中的下拉箭头选择设置,打开配置Windows Terminal的Json文件。
将复制的主题代码粘贴到schemes里面,主题配置像是个集合,应该可以支持存放多个主题配置代码,name为标识,用于设置终端应用哪个主题
在list中分别配置PowerShell的主题和cmd的主题,添加如下代码即可应用对应的主题。
注意:这里配置的主题只是在Windows Terminal中打开PowerShell和cmd所展示的主题,原始的cmd和PowerShell主题不会变化。
"colorScheme":"WarmNeon"
WarmNeon为我配置的主题name
配置启动Windows Terminal默认打开的终端
复制上图中命令提示行的guid,粘贴到defaultProfile中,这样打开Windows Terminal默认启动的就是cmd终端了。
四、更高级的打开方式
通过地址栏启动
在配置文件中添加如下代码,就可以像cmd一样在任意文件夹地址栏输入wt就可以在当前文件夹下启动wt
%localappdata%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json
"startingDirectory": "."
通过右键菜单启动
添加右键菜单,在任意路径下右键选择Windows Terminal
启动
https://github.com/microsoft/terminal/issues/1060
Windows Registry Editor Version 5.00
;Binary data is just UTF16 (LE) split every 2 bytes with a comma
;Conversion done with https://onlineutf8tools.com/convert-utf8-to-utf16?hex=true&little-endian=true&space=false&chain=split-string%253Fsplit-by-length%253Dtrue%2526separator%253D%252C
;User action
[HKEY_CLASSES_ROOT\Directory\Background\shell\WindowsTerminal]
@="Open Terminal here"
;"Icon"="%USERPROFILE%\Pictures\Icons\terminal.ico" (Location to ICO or comment out to hide icon)
"Icon"=hex(2):25,00,55,00,53,00,45,00,52,00,50,00,52,00,4f,00,46,00,49,00,4c,00,45,00,25,00,5c,00,50,00,69,00,63,00,74,00,75,00,72,00,65,00,73,00,5c,00,49,00,63,00,6f,00,6e,00,73,00,5c,00,74,00,65,00,72,00,6d,00,69,00,6e,00,61,00,6c,00,2e,00,69,00,63,00,6f,00
;User action command
[HKEY_CLASSES_ROOT\Directory\Background\shell\WindowsTerminal\command]
;@="%LOCALAPPDATA%\Microsoft\WindowsApps\wt.exe -d ."
@=hex(2):25,00,4c,00,4f,00,43,00,41,00,4c,00,41,00,50,00,50,00,44,00,41,00,54,00,41,00,25,00,5c,00,4d,00,69,00,63,00,72,00,6f,00,73,00,6f,00,66,00,74,00,5c,00,57,00,69,00,6e,00,64,00,6f,00,77,00,73,00,41,00,70,00,70,00,73,00,5c,00,77,00,74,00,2e,00,65,00,78,00,65,00,20,00,2d,00,64,00,20,00,2e,00
;Admin action
[HKEY_CLASSES_ROOT\Directory\Background\shell\WindowsTerminalAdmin]
@="Open Terminal here (Admin)"
;Show the UAC shield on the action
"HasLUAShield"=""
;"Icon"="%USERPROFILE%\Pictures\Icons\terminal.ico" (Location to ICO or comment out to hide icon)
"Icon"=hex(2):25,00,55,00,53,00,45,00,52,00,50,00,52,00,4f,00,46,00,49,00,4c,00,45,00,25,00,5c,00,50,00,69,00,63,00,74,00,75,00,72,00,65,00,73,00,5c,00,49,00,63,00,6f,00,6e,00,73,00,5c,00,74,00,65,00,72,00,6d,00,69,00,6e,00,61,00,6c,00,2e,00,69,00,63,00,6f,00
;Admin action command
[HKEY_CLASSES_ROOT\Directory\Background\shell\WindowsTerminalAdmin\command]
@="PowerShell -WindowStyle Hidden -Command \"Start-Process wt -ArgumentList '-d','.' -Verb runAs\""
为Windows Terminal配置新的Shell与默认Shell(以PowerShell Core 7为例)
%localappdata%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json
{
"$schema": "https://aka.ms/terminal-profiles-schema",
//"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
//默认编辑器guid
"defaultProfile": "{91F0E618-9220-4D55-B8A3-E1B5A663024E}",
"profiles":
{
"defaults":
{
// Put settings here that you want to apply to all profiles
},
"list":
[
{
// Make changes here to the powershell.exe profile
"guid": "{91F0E618-9220-4D55-B8A3-E1B5A663024E}",
"name": "Windows PowerShellCore 7",
// 注意:一定要写上 -nologo,否则开启 powershll 会有一段话输出,很讨厌!
//"commandline": "E:\\Program Files\\PowerShell\\7\\pwsh.exe -nologo",
"commandline": "E:\\Program Files\\PowerShell\\7\\pwsh.exe",
"icon": "ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png",
// 设置运行目录为当前目录
"startingDirectory": ".",
"colorScheme": "Campbell",
"antialiasingMode": "grayscale",
"closeOnExit": "graceful",
"cursorShape": "bar",
"fontFace": "Cascadia Mono",
"fontSize": 12,
"hidden": false,
"historySize": 9001,
"padding": "8, 8, 8, 8",
"snapOnInput": true,
"useAcrylic": false
}
]
}
}