本文介绍了如何配置Windows Terminal以提高使用效率。

首先,通过修改注册表,将Windows Terminal添加到右键菜单,并支持定位到当前目录以及以管理员身份打开。其次,提供了一个详细的配置备份示例,包括字体设置、下拉列表等。用户需将示例中的路径和图标替换为个人环境中的相应值。通过这些配置,可以提升Windows Terminal的便捷性和个性化。

添加到右键菜单并支持定位到当前目录

右键打开Windows Terminal,支持定位到当前目录:

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\WT_Primary]
@="Windows Terminal"
"Icon"="D:\\APP\\terminal-1.23.12371.0\\Images\\terminal_contrast-white.ico"

[HKEY_CLASSES_ROOT\Directory\Background\shell\WT_Primary\command]
@="D:\\APP\\terminal-1.23.12371.0\\wt -d ."

支持“Shift+右键”以管理员方式打开:

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
@="Windows Terminal (Admin)"
"ShowBasedOnVelocityId"=dword:00639bc8
"Icon"="D:\\APP\\terminal-1.23.12371.0\\Images\\terminal_contrast-white.ico"
"Extended"=""

[HKEY_CLASSES_ROOT\Directory\Background\shell\runas\command]
@="D:\\APP\\terminal-1.23.12371.0\\wt -d ."

使用方法:将上面的代码写入到文件,保存为.reg格式,然后以管理员权限运行。

注意:其中的Icon和运行程序需要修改为自己现有环境中的。

Windows Terminal配置备份

主要增加配置字体,下拉列表等

{
    "$help": "https://aka.ms/terminal-documentation",
    "$schema": "https://aka.ms/terminal-profiles-schema",
    "actions": [],
    "copyFormatting": "none",
    "copyOnSelect": false,
    "defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
    "keybindings": [
        {
            "id": "Terminal.CopyToClipboard",
            "keys": "ctrl+c"
        },
        {
            "id": "Terminal.DuplicatePaneAuto",
            "keys": "alt+shift+d"
        }
    ],
    "newTabMenu": [
        {
            "type": "remainingProfiles"
        }
    ],
    "profiles": {
        "defaults": {
            "backgroundImage": "desktopWallpaper",
            "backgroundImageOpacity": 0.31,
            "bellStyle": "none",
            "cursorShape": "filledBox",
            "font": {
                "face": "JetBrainsMono Nerd Font"
            },
            "padding": "5",
            "scrollbarState": "always"
        },
        "list": [
            {
                "commandline": "%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
                "font": {
                    "face": "JetBrainsMono Nerd Font, 汉仪书仿",
                    "size": 14
                },
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "hidden": false,
                "name": "Windows PowerShell",
                "startingDirectory": "D:\\blduan\\Desktop"
            },
            {
                "bellStyle": "none",
                "commandline": "ssh -X blduan@192.168.100.129",
                "font": {
                    "cellHeight": "1.2",
                    "face": "JetBrainsMono Nerd Font, 汉仪书仿",
                    "size": 14
                },
                "guid": "{0b9d88d7-1684-f983-1f59-6960ae51bbe0}",
                "hidden": false,
                "icon": "D:\\APP\\terminal-1.23.12371.0\\ProfileIcons\\{550ce7b8-d500-50ad-8a1a-c400c3262db3}.scale-100.png",
                "name": "VMWare-Ubuntu24.04"
            },
            {
                "bellStyle": "none",
                "commandline": "ssh blduan@192.168.100.130",
                "font": {
                    "cellHeight": "1.2",
                    "face": "JetBrainsMono Nerd Font, 汉仪书仿",
                    "size": 14
                },
                "guid": "{0b9d88d7-1684-f983-1f59-6960ae51bbe1}",
                "hidden": false,
                "icon": "D:\\APP\\terminal-1.23.12371.0\\ProfileIcons\\{550ce7b8-d500-50ad-8a1a-c400c3262db3}.scale-100.png",
                "name": "VMWare-Ubuntu24.04测试服务器"
            },
            {
                "bellStyle": "none",
                "commandline": "ssh blduan@192.168.100.131",
                "font": {
                    "cellHeight": "1.2",
                    "face": "JetBrainsMono Nerd Font, 汉仪书仿",
                    "size": 14
                },
                "guid": "{3a017205-b260-9b4b-ccdd-8bd88fa36507}",
                "hidden": false,
                "icon": "D:\\APP\\terminal-1.23.12371.0\\ProfileIcons\\{550ce7b8-d500-50ad-8a1a-c400c3262db3}.scale-100.png",
                "name": "VMWare-Ubuntu18.04 测试服务器"
            },
            {
                "commandline": "%SystemRoot%\\System32\\cmd.exe",
                "font": {
                    "face": "JetBrains Mono"
                },
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "hidden": false,
                "name": "命令提示符"
            },
            {
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": false,
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure"
            }
        ]
    },
    "schemes": [],
    "themes": []
}