Skip to content

Instantly share code, notes, and snippets.

@Garwih
Last active December 8, 2023 15:55
Show Gist options
  • Star 19 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save Garwih/b4ec0d853e0f3093874e919ace7fce2f to your computer and use it in GitHub Desktop.
Save Garwih/b4ec0d853e0f3093874e919ace7fce2f to your computer and use it in GitHub Desktop.
将 Windows Terminal 添加到右键菜单

将 Windows Terminal 添加到右键菜单

将以下代码保存到扩展名为 .reg 的文件中,双击打开

需要按住 shift + 右键打开

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\wt]
@="Windows Terminal Here"
"Extended"=""

[HKEY_CLASSES_ROOT\Directory\Background\shell\wt\command]
@="C:\\Users\\你的用户名\\AppData\\Local\\Microsoft\\WindowsApps\\wt.exe"

不需要 shift,直接右键打开

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\wt]
@="Windows Terminal Here"

[HKEY_CLASSES_ROOT\Directory\Background\shell\wt\command]
@="C:\\Users\\你的用户名\\AppData\\Local\\Microsoft\\WindowsApps\\wt.exe"

当前目录打开时,Terminal 里的路径不是当前目录

检查一下配置文件,看下是否有以下内容,删除之后就可以了。

{
    "profiles": [
        {
            "startingDirectory" : "%USERPROFILE%"
        }
    ]
}

v0.5 之后的版本(如 0.5.2661.0 )需要修改为

"startingDirectory": null

参考:microsoft/terminal#620

@StrongerLph
Copy link

非常感谢,按照您的提示,已经成功了,原因是注册表里的配置跟文件配置不一致。

@sheyu921
Copy link

sheyu921 commented Mar 3, 2021

这是一个非常实用的教程,比现在windows terminal自带的都更好用。

@samzhou
Copy link

samzhou commented Oct 7, 2021

按照上面方法打开后还是home目录,按照这个就成功了:

"profiles":
    {
        "defaults":
        {
            "startingDirectory":  null
        },

version: 1.10.2383.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment