microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.27k stars 8.27k forks source link

'Open in Terminal' not appearing in Windows Explorer context menu #16236

Closed CodeGenStudio closed 10 months ago

CodeGenStudio commented 11 months ago

Windows Terminal version

1.18.2822.0

Windows build number

10.0.19045.3570

Other Software

No response

Steps to reproduce

No steps, just install, uninstall, reinstall.

Expected Behavior

Right clicking in any folder in Explorer should show 'Open in Terminal'

Actual Behavior

I've installed Terminal from the MS Store as well as via the bundle in the releases page. However, the 'Open in Terminal' option does not appear in Explorer when I right click a folder. I've also install Terminal on another PC and it is showing up there, but not on my current PC.

I've tried following some tutorials to manually add it in regedit but they do not work. If someone can point out on how to go about adding the context menu to Explorer it would be much appreciated, as I can easily load projects into terminal without having to cd to it each time.

Thank you.

CodeGenStudio commented 11 months ago

Hate to be that guy, but I assume this is being looked into during the next phase? (Based on the current tags)

zadjii-msft commented 11 months ago

Nope. Backlog is for "things that we should get to eventually, but don't have in a particular milestone". I'm not even sure this is something that we can fix, either. I must've missed the triage meeting where we stuck this on the backlog.

There've been threads about this in the past, where for some reason, the Store & file explorer seem to lose the registration for our shell context menus. It's been terribly unreliable.

There's a very dumb question: have you restarted since re-installing the Terminal/? Explorer is weird about context menu entries sometimes. I think it caches the context menu entries. (taskkill /f /im explorer.exe && explorer.exe might also work without a full reboot)

Other things that might be relevant:

If that all doesn't work, we might need you to send feedback using the Feedback Hub and the "Desktop Environment > Right-click context menu" category: image

If you "share" that feedback here, I can make sure it gets promoted internally

CodeGenStudio commented 11 months ago

I actually did do a restart after re-installing, but that did not do anything. I will retry tho, including the taskkill command as well - if they don't solve this I'll submit a report via Feedback Hub. Either way, I'll make sure to provide an update. Preciate the support

zadjii-msft commented 11 months ago

FWIW, we don't use a .reg file to install these shell extensions. We're leveraging the built-in support in MSIX packages for declaring your shell extensions. I honestly don't know how it gets hooked up from the manifest to the actual context menu. If I did, then it'd be pretty easy to write a script for us to look if we're still even registered

see: https://github.com/microsoft/terminal/blob/d14524cd4cc4970bb1b6456f9667e2dd661b9854/src/cascadia/CascadiaPackage/Package.appxmanifest#L221-L230


investigation notes:

Under Computer\HKEY_USERS\S-1-12-1-3854915828-1115607085-215819146-1265292413\Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Cached Value name: {9F156763-7844-4DC4-B2B1-901F640F5155} {A08CE4D0-FA25-44AB-B57C-C7B1C323E0B9} 0xFFFF reg_binary

01 00 00 00 00 00 00 00 
DD 58 2B 81 77 16 DA 01

That's clearly useless, what's Preview got?


Under Computer\HKEY_USERS\S-1-12-1-3854915828-1115607085-215819146-1265292413\Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Cached Value name: {02DB545A-3E20-46DE-83A5-1329B1E88B6B} {A08CE4D0-FA25-44AB-B57C-C7B1C323E0B9} 0xFFFF reg_binary

01 00 00 00 00 00 00 00 
E1 45 64 81 77 16 DA 01

more garbage, hmm

3052 commented 11 months ago

OK got it working. first DON'T download the MsixBundle, it does stupid stuff with the installation. the terminal gets installed to some weird folder with extreme security settings. I cant mess with it even as an admin. instead just get the dumb zip file, like this:

https://github.com/microsoft/terminal/releases/download/v1.18.2822.0/Microsoft.WindowsTerminal_1.18.2822.0_x64.zip

extract to wherever, for example:

C:\terminal-1.18.2822.0

then save the below as INSTALL.REG:

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\background\shell\terminal\command]
@="C:\\terminal-1.18.2822.0\\WindowsTerminal.exe"

and you can fix the starting folder like this:

{
   "profiles": {
      "defaults": {"startingDirectory": ""}
   }
}

done. Microsoft making stuff WAY harder than it needs to be.

DHowett commented 11 months ago

Two notes about 3052's solution:

  1. It will work for the MSIX version of Terminal if you change the path to %LOCALAPPDATA%\Microsoft\WindowsApps\wt.exe
  2. You do not need to change the global startingDirectory setting if you add -d "%V\." to the commandline. That will reduce the impact of this change to only the launched terminal tab rather than all terminal profiles.
DHowett commented 11 months ago

@3052 Please follow this repository's Code of Conduct.

DHowett commented 11 months ago

@DHowett was that really needed? the comment was deleted like an hour ago, for good reason. please dont make trouble where there is none.

Yes, it was. I received two e-mail notifications for two separate comments which have since been deleted. I was willing to let the first one slide, and I am only warning you for the second.

Deleting a comment doesn't really let you un-say whatever was in it.

zadjii-msft commented 10 months ago

@3052 We're waiting for @CodeGenStudio to send feedback on this using the Feedback Hub, so that we can get diagnostics sent to the context menu team. If you're seeing the same issue, then you're also welcome to send feedback in the same way. Clearly, there's a bug in the way explorer populates context menu entries from packaged apps in certain scenarios. We'd love to help that team get to the bottom of it ☺️

3052 commented 10 months ago

@zadjii-msft cant you just reproduce the issue yourself? if not, then it makes sense to request this information. my understanding is that this is a known and long standing issue, so we are well past the point of needing to verify that its valid and/or reproducible.

zadjii-msft commented 10 months ago

I sure can't! Hence why I'm asking for help 😉

CodeGenStudio commented 10 months ago

After trying all the suggested solutions it still does not work - HOWEVER, the context menu does appear when I right click a directory. Never noticed this until now so I'm not exactly sure which solution at least made this work, if it wasn't working before.

Anyway this is much faster than cd manually, although right clicking in the empty space would be more ideal.

@3052 I understand your frustration but you don't have to be so rude. @zadjii-msft I didn't mean to start trouble, just couldn't find an issue regarding this mentioned previously. Appreciate all the support from you guys till now.

Let me know if you guys have any other suggestions.

EDIT: I have still yet to submit a report via Feedback Hub, forgot about that. will do that and update here

zadjii-msft commented 10 months ago

@3052 Since you're hitting this too, we could always use feedback from you as well. That would be better than posting comments and then deleting them to keep the thread alive.

I firmly suspect that this is an OS-side bug, not something in the Terminal codebase. I further suspect that this is something that was fixed in Windows 11 (since I know there was quite a few bugfixes for the way File Explorer loaded shell extensions in 22000). However, the only way for us to be sure is with logs, that Feedback Hub would capture, that we can then share with the OS shell folks and have them investigate.

HOWEVER, the context menu does appear when I right click a directory

This SPECIFICALLY makes me think what you're seeing here is something like #10119. Honestly, we should probably just de-dupe this to that thread.

* MSFT:18029514 got backported to Windows 10 in MSFT:29893761, in the 2021.04 C servicing release
3052 commented 10 months ago

yeah both issues are the same, with the older being over two years old. so hopefully you can understand my frustration when you are still trying to "confirm" the issue. the issue is valid and well known. I am currently using this:

https://github.com/microsoft/terminal/issues/16236#issuecomment-1808992396

but it would be nice if it was properly fixed

zadjii-msft commented 10 months ago

I'm not trying to confirm the issue - it's been plenty confirmed. I'm trying to gather diagnostics from users who are repro'ing this bug, so that our internal partners (who aren't reproing it) can try to investigate.

3052 commented 10 months ago

I think time would be better spent in the other issue. its older and has more participants

zadjii-msft commented 10 months ago

Yea, that seems sensible here. Let's merge the threads.

/dup #10119

danny-dang commented 2 months ago

I solved this by upgrading to Windows 11, and then download the new Terminal app from Appstore.