2.6a Windows Terminal代码片段
原创2025年1月8日大约 1 分钟
前言
在编写脚本的时候,如果使用文件夹,一条条脚本分散开来,检索、使用都不是很方便。而代码片段,则解决了一部分这个问题
- 使用该功能,需要下载Windows Terminal 1.22[^1]
- 打开配置文件,并且找到
actions
key


- 然后,在
actions
这个列表中,添加一个形如下面的对象
{
"command":
{
"action": "sendInput",
"input": "这里填你的命令"
},
"name": "这里填你的命令名称"
}
> [!tip] Tip
> `action`这一栏只能填`sendInput`
- 然后按 `ctrl+shift+p` 打开命令面板,输入 `打开面板片段窗格` ,就可以看到刚刚添加的代码片段了

## 参见
[Windows 终端预览版 1.22 版 - Windows 命令行 --- Windows Terminal Preview 1.22 Release - Windows Command Line](https://devblogs.microsoft.com/commandline/windows-terminal-preview-1-22-release/#snippets-pane)
## 脚注
[^1]: 截止到写作日期 `2025/01/08` ,目前Windows Terminal 1.22仍处于预览阶段,可以前往Mircosoft Store下载Windows Terminal Preview来使用
链接到当前文件 0
没有文件链接到当前文件