Windows Terminal 使用 PuTTY 连接 COM 串口

Windows Terminal 支持 PowerShell、cmd、Azure Could、WSL、ssh,界面美观流畅,配置选项丰富,一经推出广受好评。美中不足的是无法支持 COM 串口通信。

经过一番摸索,似乎可以借助 PuTTY 的 PLINK.EXE 曲线救国,只要载入 PuTTY 之前保存的 Session 即可。

注:PUTTY.EXE 本身是纯 GUI,不可用于 Windows Terminal,但是 PLINK.EXE 可以。

假设在 PuTTY 中连接 COM 串口的 Session 保存为 “PuTTY COM Session”,则需要在 Terminal 的 setting.json 中添加如下内容:

{
  "commandline": "D:\\putty\\PLINK.EXE -load \"PuTTY COM Session\"",
  "guid": "{141d171c-4fd9-426d-9008-8cbc4b0b05d3}",
  "hidden": false,
  "icon": "ms-appx:///ProfileIcons/{9acb9455-ca41-5af7-950f-6bca1bc9722f}.png",
  "name": "putty-com-session"
},

完整 Terminal 配置如下供参考。

{
    "$schema": "https://aka.ms/terminal-profiles-schema",
    "copyFormatting": "none",
    "copyOnSelect": true,
    "defaultProfile": "{9ac0fc3b-62f8-4fcd-b477-71f164a6ad82}",
    "profiles": 
    {
        "defaults": 
        {
            "acrylicOpacity": 0.90000000000000002,
            "antialiasingMode": "cleartype",
            "bellStyle": 
            [
                "audible",
                "taskbar"
            ],
            "colorScheme": "Ubuntu",
            "cursorShape": "vintage",
            "font": 
            {
                "face": "Ubuntu Mono"
            }
        },
        "list": 
        [
            {
                "commandline": "ssh zijian@zijian-vm",
                "guid": "{9ac0fc3b-62f8-4fcd-b477-71f164a6ad82}",
                "icon": "ms-appx:///ProfileIcons/{9acb9455-ca41-5af7-950f-6bca1bc9722f}.png",
                "name": "LinuxVM",
                "startingDirectory": "%USERPROFILE%"
            },
            {
                "commandline": "powershell.exe",
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "hidden": false,
                "name": "Windows PowerShell"
            },
            {
                "commandline": "cmd.exe",
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "hidden": true,
                "name": "\u547d\u4ee4\u63d0\u793a\u7b26"
            },
            {
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": true,
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure"
            },
            {
                "commandline": "C:\\Users\\zijian\\Downloads\\putty\\PLINK.EXE -load \"Default Settings\"",
                "guid": "{141d171c-4fd9-426d-9008-8cbc4b0b05d3}",
                "hidden": true,
                "icon": "ms-appx:///ProfileIcons/{9acb9455-ca41-5af7-950f-6bca1bc9722f}.png",
                "name": "putty-session"
            },
            {
                "commandline": "C:\\Users\\zijian\\Downloads\\putty\\PLINK.EXE -load \"COM\"",
                "guid": "{323f60e8-afd4-45a8-8f57-b593b66c7874}",
                "icon": "ms-appx:///ProfileIcons/{9acb9455-ca41-5af7-950f-6bca1bc9722f}.png",
                "name": "PuTTY-COM"
            }
        ]
    },
    "schemes": 
    [
        {
            "background": "#2E3436",
            "black": "#0C0C0C",
            "blue": "#0037DA",
            "brightBlack": "#767676",
            "brightBlue": "#3B78FF",
            "brightCyan": "#61D6D6",
            "brightGreen": "#16C60C",
            "brightPurple": "#B4009E",
            "brightRed": "#E74856",
            "brightWhite": "#F2F2F2",
            "brightYellow": "#F9F1A5",
            "cursorColor": "#FFFFFF",
            "cyan": "#3A96DD",
            "foreground": "#D3D7CF",
            "green": "#13A10E",
            "name": "Ubuntu",
            "purple": "#881798",
            "red": "#C50F1F",
            "selectionBackground": "#FFFFFF",
            "white": "#CCCCCC",
            "yellow": "#C19C00"
        }
    ],
    "showTabsInTitlebar": true,
    "trimBlockSelection": true,
    "useAcrylicInTabRow": false
}
上一篇:c++ 判断三角形类型


下一篇:WPF开发随笔收录-唯一标识符GUID