1. 程式人生 > 實用技巧 >windows terminal新增自定義的終端工具或命令

windows terminal新增自定義的終端工具或命令

1.大致明白Terminal開啟終端的原理

我們看一下terminal的配置檔案

{
      // Make changes here to the powershell.exe profile.
      "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
      "name": "Windows PowerShell",
      "commandline": "powershell.exe",
      "hidden": false,
      "acrylicOpacity": 0.7,
      "colorScheme": "BlulocoLight",
      "useAcrylic": true
}

主要看下commandline這個引數,可以看到Terminal啟動powershell時,實際就是下發了一個命令"powershell.exe"

2.自定義一個配置製作一個終端

複製一個powershell配置出來,然後自己去網上找個guid生成工具生成一個新的id
比如,我這裡想做一個ssh的終端,專門用來連線我的伺服器。

{
      // Make changes here to the powershell.exe profile.
      "guid": "{87650182-7063-41ED-B1F3-1B5711C49DC9}",
      "name": "10.200.1.122",
      "commandline": "ssh 10.200.1.122 -l root",
      "hidden": false,
      "acrylicOpacity": 0.7,
      "colorScheme": "BlulocoLight",
      "icon": "C:/Users/Pictures/ubuntu-icon.png",
      "useAcrylic": true
}

效果如下:

上面主要改了guid、name、commandline和icon。icon這個加上去就是為了在Terminal中開啟的時候有個圖示,顯得稍微好看些。
根據上面的大致方法,可以根據自己的要求來定製一些終端。比如常用的telnet、ssh和git bash等。