Windows Terminal 完全配置教程(主题以及启动设置)

一、安装Windows terminal

Microsoft Store搜索Windows terminal

第一个和第二个都可以!!

 

二、选择主题
Windows terminal提供了大量的主题可以选择,当然也可以像VScode文本编辑器一样自行配置。


登陆如下网址,选择一个你喜欢的主题复制主题代码
https://atomcorp.github.io/themes/



三、配置主题
打开Windows terminal

Win+R运行,输入wt

点击Windows terminal中的下拉箭头选择设置,打开配置Windows Terminal的Json文件。

将复制的主题代码粘贴到在list中,分别配置PowerShell的主题和cmd的主题,添加刚才获得代码即可应用对应的主题。name为标识,用于设置终端应用哪个主题。

 

我的主题配置如下:

// This file was initially generated by Windows Terminal Preview 1.5.3242.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// 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}",
    // You can add more global application settings here.
    // To learn more about global settings, visit https://aka.ms/terminal-global-settings
    // If enabled, selections are automatically copied to your clipboard.
    "copyOnSelect": false,
    // If enabled, formatted data is also copied to your clipboard
    "copyFormatting": false,
    // A profile specifies a command to execute paired with information about how it should look and feel.
    // Each one of them will appear in the 'New Tab' dropdown,
    //   and can be invoked from the commandline with `wt.exe -p xxx`
    // To learn more about profiles, visit https://aka.ms/terminal-profile-settings
    "profiles": {
        "defaults": /*全局配置*/ {
            // Put settings here that you want to apply to all profiles
            // 默认打开的 Profile GUID(下面会详细介绍)
            "defaultProfile": "{97838c1f-307b-477a-b7fe-c9965c347e0b}",
            "startingDirectory": null,
            // 终端窗口默认大小
            "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": "{97838c1f-307b-477a-b7fe-c9965c347e0b}",
                /*网页搜索guid生成可以获得每个程序唯一的guid,visual studio内的工具也有生成guid的功能*/
                "name": "CMD",
                "commandline": "cmd.exe",
                /*程序位置*/
                "hidden": false,
                "tabTitle": "CMD", /*名称*/
                "foreground": "#DCDCDC", /*字体颜色*/
                "icon": "C:/Users/ChiamZhang/Pictures/Saved Pictures/vz.jpeg", /*ICO图标*/
                "backgroundImage": "C:/Users/ChiamZhang/Pictures/Saved Pictures/back.jpg", /*终端背景图*/
                "acrylicOpacity": 0.95,
                /*亚克力透明效果*/
                "backgroundImageOpacity": 0.70,
                /*背景透明度*/
                "backgroundImageStretchMode": "fill",
                "closeOnExit": true,
                "colorScheme": "Campbell",
                "cursorColor": "#FFFFFF",
                "cursorShape": "bar",
                "fontFace": "Consoles",
                "fontSize": 12,
                "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": "C:/Users/ChiamZhang/Pictures/Saved Pictures/vz2.png",
                "backgroundImage": "C:/Users/ChiamZhang/Pictures/Saved Pictures/back2.jpeg",
                "acrylicOpacity": 0.95,
                /*亚克力透明效果*/
                "backgroundImageOpacity": 0.70,

                "backgroundImageStretchMode": "fill",
                "colorScheme": "Campbell",
                "cursorColor": "#FFFFFF",
                "cursorShape": "bar",
                "fontFace": "Consoles",
                "fontSize": 12,
                "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": "C:/Users/ChiamZhang/Pictures/Saved Pictures/vz2.png", /*ICO图标*/
                "backgroundImage": "C:/Users/ChiamZhang/Pictures/Saved Pictures/back2.jpeg", /*终端背景图*/
                "acrylicOpacity": 0.75,
                "backgroundImageOpacity": 0.1,
                "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": "C:/Users/ChiamZhang/Pictures/Saved Pictures/vz.jpeg", /*ICO图标*/
                "backgroundImage": "C:/Users/ChiamZhang/Pictures/Saved Pictures/back.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
            },
            
            {
                "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"
    // Add custom color schemes to this array.
    // To learn more about color schemes, visit https://aka.ms/terminal-color-schemes
    // Add custom actions and keybindings to this array.
    // To unbind a key combination from your defaults.json, set the command to "unbound".
    // To learn more about actions and keybindings, visit https://aka.ms/terminal-keybindings
    "actions": [
        // Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
        // These two lines additionally bind them to Ctrl+C and Ctrl+V.
        // To learn more about selection, visit https://aka.ms/terminal-selection
        {
            "command": {
                "action": "copy",
                "singleLine": false
            },
            "keys": "ctrl+c"
        },
        {
            "command": "paste",
            "keys": "ctrl+v"
        },
        // Press Ctrl+Shift+F to open the search box
        {
            "command": "find",
            "keys": "ctrl+shift+f"
        },
        // Press Alt+Shift+D to open a new pane.
        // - "split": "auto" makes this pane open in the direction that provides the most surface area.
        // - "splitMode": "duplicate" makes the new pane use the focused pane's profile.
        // To learn more about panes, visit https://aka.ms/terminal-panes
        {
            "command": {
                "action": "splitPane",
                "split": "auto",
                "splitMode": "duplicate"
            },
            "keys": "alt+shift+d"
        }
    ]
}


配置启动Windows Terminal默认打开的终端,这样打开Windows Terminal默认启动的就是cmd终端了。

四、更高级的打开方式

通过地址栏启动

      在配置文件中添加如下代码,可以在地址栏输入WT即可以启动。


 

通过右键菜单启动

添加右键菜单,在任意路径下右键选择Windows Terminal启动
注册表进入如下路径

计算机\HKEY_CLASSES_ROOT\Directory\Background\shell


默认应该会有两个子项,cmd和powershell
右击shell新增项Windows Terminal

新增下图所示的四个字符串值及一个DWORD值

(默认)	字符串	在此处打开Windows Terminal	#这个值是在右键菜单中显示的值
Extended	字符串	#这个值作用是仅支持在按住Shift+右键的时候才显示Windows Terminal选项,删掉则可以不用按住Shift也可以显示Windows Terminal选项
Icon	字符串	C:\Users\xxxx\Pictures\terminal.ico	#想要在右键菜单中显示的图标路径,图标需要单独下载
NoWorkingDirectory	字符串
ShowBasedOnVelocityId	DWORD	639bc8(十六进制)	#在菜单中显示或隐藏Windows Terminal选项



在Windows Terminal上右键新建项command
修改默认值为:

 

C:\Users\你的用户名\AppData\Local\Microsoft\WindowsApps\wt.exe -d "%V"

 

 

配置完成即可在任意文件夹内右键打开Windows Terminal

 

更多配置信息参考官方配置文档


Windows 终端中的配置文件设置

### Windows Terminal 使用教程 #### 一、简介 Windows Terminal 是一款现代且高效的命令行工具,支持多种 shell 环境如 PowerShell 和 WSL (Windows Subsystem for Linux)[^3]。 #### 二、安装与配置默认 Shell 为了更好地利用 Windows Terminal 功能,默认启动的应用程序可以被更改为最新版本的 PowerShell 或其他偏好环境。这可以通过修改设置来完成[^2]。 #### 三、界面定制 对于追求个性化体验的用户来说,通过 Oh My Posh 插件能够轻松实现对 Windows Terminal 外观上的增强,同时还可以配合 Visual Studio Code 主题达到一致性的视觉效果[^1]。 #### 四、多窗格操作 掌握多窗格功能有助于提高工作效率。具体方法如下: - **创建新窗格** 可以使用 `Ctrl+Shift+\` 来水平分割当前窗口;也可以按 `Alt+Shift+-` 实现垂直划分。 - **调整窗格布局** 利用组合键 `Alt+Arrow Keys` 移动焦点至不同窗格间;而当需要改变某个特定窗格尺寸时,则可借助鼠标拖拽边缘或采用键盘快捷方式 `Shift+Alt+Arrow Keys` 进行动态调节。 - **管理多个窗格** 若想关闭不再使用的窗格,只需按下 `Ctrl+W`; 若要交换两个相邻窗格的位置,可通过右键菜单选项或是输入相应命令达成目的[^4]。 ```powershell # 示例:在 PowerShell 中执行命令新建一个竖直方向的新窗格并运行指定程序 wt -p "Command Prompt" split-pane ; wt -d . cmd.exe /k echo Hello from CMD! ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值