Opening terminal from Windows 10 context menu doesn't override default directory #18705

Closed
opened 2026-01-31 06:21:54 +00:00 by claunia · 6 comments
Owner

Originally created by @u84six on GitHub (Oct 17, 2022).

Windows Terminal version

1.15.2874.0

Windows build number

19044.2006

Other Software

No response

Steps to reproduce

  1. Configure a default directory in Terminal's Profile settings
  2. In explorer, navigate to any folder other than the one configured in settings
  3. Right-click in explorer and select "Windows Terminal Here"
  4. Note that the terminal starts in the default directory.

If the command is called "Windows Terminal Here", you'd think that it would always open in that location regardless of what's configured as the default.

Expected Behavior

When opening from explorer context menu "Windows Terminal Here", it should override the default directory.

Actual Behavior

Always opens in the default directory when selecting "Windows Terminal Here"

Originally created by @u84six on GitHub (Oct 17, 2022). ### Windows Terminal version 1.15.2874.0 ### Windows build number 19044.2006 ### Other Software _No response_ ### Steps to reproduce 1. Configure a default directory in Terminal's Profile settings 2. In explorer, navigate to any folder other than the one configured in settings 3. Right-click in explorer and select "Windows Terminal Here" 4. Note that the terminal starts in the default directory. If the command is called "Windows Terminal Here", you'd think that it would always open in that location regardless of what's configured as the default. ### Expected Behavior When opening from explorer context menu "Windows Terminal Here", it should override the default directory. ### Actual Behavior Always opens in the default directory when selecting "Windows Terminal Here"
Author
Owner

@DHowett commented on GitHub (Oct 17, 2022):

Thanks for the report!

We did not author the shell extension titled "Windows Terminal Here". Our officially-supported shell extension is titled "Open in Terminal". You will need to take this up with the author of the "Windows Terminal Here" shell extension.

@DHowett commented on GitHub (Oct 17, 2022): Thanks for the report! _We did not author the shell extension titled "Windows Terminal Here"._ Our officially-supported shell extension is titled "Open in Terminal". You will need to take this up with the author of the "Windows Terminal Here" shell extension.
Author
Owner

@u84six commented on GitHub (Oct 17, 2022):

Ok, I probably added this a long time ago to get this feature. Sorry! So which version of Windows Terminal has shell integration? I don't see "Open in Terminal" command in the context menu with the Windows Terminal version that I have

@u84six commented on GitHub (Oct 17, 2022): Ok, I probably added this a long time ago to get this feature. Sorry! So which version of Windows Terminal has shell integration? I don't see "Open in Terminal" command in the context menu with the Windows Terminal version that I have
Author
Owner

@DHowett commented on GitHub (Oct 17, 2022):

Ah! The shell extension should be present in all packaged versions of Windows Terminal since May 2020. If you're using Terminal as installed by scoop or by unzipping the archive yourself, you'll need to register the shell extension yourself.

@DHowett commented on GitHub (Oct 17, 2022): Ah! The shell extension should be present in all _packaged_ versions of Windows Terminal since May 2020. If you're using Terminal as installed by `scoop` or by unzipping the archive yourself, you'll need to register the shell extension yourself.
Author
Owner

@u84six commented on GitHub (Oct 17, 2022):

Well that's basically what I did. I downloaded from github on the releases page: Microsoft.WindowsTerminal_Win10_1.15.2524.0_8wekyb3d8bbwe.msixbundle
Then I registered the shell extension by doing the following:
[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"
This registry tweak created the shell command. Is this the recommended way? If so, then I suppose the defect is valid, no?

@u84six commented on GitHub (Oct 17, 2022): Well that's basically what I did. I downloaded from github on the releases page: Microsoft.WindowsTerminal_Win10_1.15.2524.0_8wekyb3d8bbwe.msixbundle Then I registered the shell extension by doing the following: [HKEY_CLASSES_ROOT\directory\background\shell\wt]@="Windows Terminal Here" [HKEY_CLASSES_ROOT\directory\background\shell\wt\command] @="C:\\Users\\<username>\\AppData\\Local\\Microsoft\\WindowsApps\\wt.exe" This registry tweak created the shell command. Is this the recommended way? If so, then I suppose the defect is valid, no?
Author
Owner

@DHowett commented on GitHub (Oct 17, 2022):

Ah, I understand.

No, you'll need to register the actual shell extension library WindowsTerminalShellExt.dll.
The code in this library chooses how best to pass the starting directory to Terminal.

It looks something like this. I don't have it totally nailed down. It's important for me to note here that unpackaged installation is not fully supported, and that this will not work for the "main" context menu in Windows 11.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\OpenInTerminal]
@="{9f156763-7844-4dc4-b2b1-901f640f5155}"

[HKEY_CLASSES_ROOT\CLSID\{9f156763-7844-4dc4-b2b1-901f640f5155}]
@="Open in Terminal Context Menu Handler"

[HKEY_CLASSES_ROOT\CLSID\{9f156763-7844-4dc4-b2b1-901f640f5155}\InProcServer32]
@="C:\\path\\to\\terminal\\installation\\WindowsTerminalShellExt.dll"
"ThreadingModel"="Apartment"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved]
"{9f156763-7844-4dc4-b2b1-901f640f5155}"="Open in Terminal Stable Shell Extension"

If you would rather continue using yours, change the command to wt.exe -d "%V\." (if I recall correctly.)
Eventually, the one we ship will gain support for reading which profiles you have and, perhaps, enumerating open instances of Terminal to open a tab in. All things in time. 😄

@DHowett commented on GitHub (Oct 17, 2022): Ah, I understand. No, you'll need to register the actual shell extension library `WindowsTerminalShellExt.dll`. The code in this library chooses how best to pass the starting directory to Terminal. It looks something like this. I don't have it totally nailed down. It's important for me to note here that unpackaged installation is not fully supported, and that this will not work for the "main" context menu in Windows 11. ``` Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\OpenInTerminal] @="{9f156763-7844-4dc4-b2b1-901f640f5155}" [HKEY_CLASSES_ROOT\CLSID\{9f156763-7844-4dc4-b2b1-901f640f5155}] @="Open in Terminal Context Menu Handler" [HKEY_CLASSES_ROOT\CLSID\{9f156763-7844-4dc4-b2b1-901f640f5155}\InProcServer32] @="C:\\path\\to\\terminal\\installation\\WindowsTerminalShellExt.dll" "ThreadingModel"="Apartment" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved] "{9f156763-7844-4dc4-b2b1-901f640f5155}"="Open in Terminal Stable Shell Extension" ``` If you would rather continue using yours, change the `command` to `wt.exe -d "%V\."` (if I recall correctly.) Eventually, the one we ship will gain support for reading which profiles you have and, perhaps, enumerating open instances of Terminal to open a tab in. All things in time. :smile:
Author
Owner

@u84six commented on GitHub (Oct 18, 2022):

I went with the manual way that I had previously done and added the -d "%V." launch flag and it fixed the problem.Thanks!!
On Monday, October 17, 2022 at 06:57:11 PM EDT, Dustin L. Howett @.***> wrote:

Ah, I understand.

No, you'll need to register the actual shell extension library WindowsTerminalShellExt.dll.
The code in this library chooses how best to pass the starting directory to Terminal.

It looks something like this. I don't have it totally nailed down. It's important for me to note here that unpackaged installation is not fully supported, and that this will not work for the "main" context menu in Windows 11.
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\OpenInTerminal]
@="{9f156763-7844-4dc4-b2b1-901f640f5155}"

[HKEY_CLASSES_ROOT\CLSID{9f156763-7844-4dc4-b2b1-901f640f5155}]
@="Open in Terminal Context Menu Handler"

[HKEY_CLASSES_ROOT\CLSID{9f156763-7844-4dc4-b2b1-901f640f5155}\InProcServer32]
@="C:\path\to\terminal\installation\WindowsTerminalShellExt.dll"
"ThreadingModel"="Apartment"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved]
"{9f156763-7844-4dc4-b2b1-901f640f5155}"="Open in Terminal Stable Shell Extension"

If you would rather continue using yours, change the command to wt.exe -d "%V." (if I recall correctly.)
Eventually, the one we ship will gain support for reading which profiles you have and, perhaps, enumerating open instances of Terminal to open a tab in. All things in time. 😄


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: @.***>

@u84six commented on GitHub (Oct 18, 2022): I went with the manual way that I had previously done and added the -d "%V\." launch flag and it fixed the problem.Thanks!! On Monday, October 17, 2022 at 06:57:11 PM EDT, Dustin L. Howett ***@***.***> wrote: Ah, I understand. No, you'll need to register the actual shell extension library WindowsTerminalShellExt.dll. The code in this library chooses how best to pass the starting directory to Terminal. It looks something like this. I don't have it totally nailed down. It's important for me to note here that unpackaged installation is not fully supported, and that this will not work for the "main" context menu in Windows 11. Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\OpenInTerminal] @="{9f156763-7844-4dc4-b2b1-901f640f5155}" [HKEY_CLASSES_ROOT\CLSID\{9f156763-7844-4dc4-b2b1-901f640f5155}] @="Open in Terminal Context Menu Handler" [HKEY_CLASSES_ROOT\CLSID\{9f156763-7844-4dc4-b2b1-901f640f5155}\InProcServer32] @="C:\\path\\to\\terminal\\installation\\WindowsTerminalShellExt.dll" "ThreadingModel"="Apartment" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved] "{9f156763-7844-4dc4-b2b1-901f640f5155}"="Open in Terminal Stable Shell Extension" If you would rather continue using yours, change the command to wt.exe -d "%V\." (if I recall correctly.) Eventually, the one we ship will gain support for reading which profiles you have and, perhaps, enumerating open instances of Terminal to open a tab in. All things in time. 😄 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: ***@***.***>
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#18705