Guiyunweb's blog

如何将windows terminal 添加到右键菜单

发表于: 2020-01-19 03:53:02标签:终端 windows 阅读: 65
  • 打开控制台,在控制台里输入echo %USERPROFILE% 并记录打印的数值

  • 接着输入mkdir %USERPROFILE%\AppData\Local\Terminal\创建文件夹

  • 接着输入explorer %USERPROFILE%\AppData\Local\Terminal\ ,打开刚才创建的文件夹,并下载图标 ,并复制到刚才弹出的资源管理器里面

  • 创建一个addwt.reg的文件,编辑一下内容,并保存

    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\Directory\Background\shell\wt]
    @="Terminal"
    "Icon"="%USERPROFILE%\\AppData\\Local\\Terminal\\terminal.ico"
    ;在这里输入将C:\\Users\\Guiyun\\换成echo %USERPROFILE% 打印的数值,记得将所有的\转译成\\
    [HKEY_CLASSES_ROOT\Directory\Background\shell\wt\command]
    @="C:\\Users\\Guiyun\\AppData\\Local\\Microsoft\\WindowsApps\\wt.exe"
    
  • 双击addwt.reg文件,一路选是就可以了

  • 现在在单击右键,terminal 就出现了

  • 打开windows terminal的配置文件,添加"startingDirectory": null这个配置

    
    // 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}",
    
        "profiles":
        [
            {
                // Make changes here to the powershell.exe profile
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "name": "Windows PowerShell",
                "commandline": "powershell.exe",
                "hidden": false,
                // 添加这一行,能默认打开进入右键所在的文件夹
                "startingDirectory": null
            },
            {
                // Make changes here to the cmd.exe profile
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "name": "cmd",
                "commandline": "cmd.exe",
                "hidden": false
            },
            {
                "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"
        "keybindings": []
    }
    

    这样右键配置windows terminal就好了