Windows terminal context menu

Windows terminal context menu

Inspired from Windows terminal issue Add «open Windows terminal here» into right-click context menu #1060. Thanks to you all giants ❤

Windows terminal is an excellent terminal. But it does not offer a basic function which is right click context menu!
Without it, I have to cd to my working directory everytime. It’s inefficient.

So I wrote this script to deal with it.

  • Two layers of context menu
  • Auto parse settings.json to contruct menu
  • With uninstaller

Clone this repo git clone https://github.com/kerol2r20/Windows-terminal-context-menu

Run powershell (no need to get admin access right)

Change the execution policy Set-ExecutionPolicy Unrestricted -scope CurrentUser

Run SetupContextMenu.ps1 script

⚠️ If you find no item in your context menu, it may be caused by the old style profiles.json. You can delete %LocalAppData%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\profiles.json and restart Windows terminal. The new one will be generated. Ref to microsoft/terminal#4556

  1. Run SetupContextMenu.ps1 -uninstall:$true

This script will parse the settings.json file to generate menu items. However you can customize it.
Put any icon file into icon folder and modify the config.json like the following.

Config reference

  • global
    • extended[bool]: if set this to true, context menu will only show up when right click with shift
  • profiles
    • guid[string]: this GUID of your profile defined in settings.json
      • hidden[bool]: overwrites the visibility of the profile, if defined
      • icon[string]: filename of your ico file, you must put this file in icon folder
      • label[string]: context menu label
      • showRunAs[bool]: add run as administrator item for this profile

I’m not sure that icons file are legal or not. If you feel it is not ok, please tell me. Thanks.

How to add Windows Terminal to context menu? [closed]

Want to improve this question? Update the question so it’s on-topic for Stack Overflow.

Closed 12 months ago .

Microsoft released Windows terminal as a Microsoft Store app. How to add it to the context menu or replace ‘Open Powershell window here’ with it ?

2 Answers 2

There might have been several approaches discussed everywhere, but none of them is up-to-date nor offers flexibility. So I started a new open source project and provided two PowerShell scripts to help.

You can run install.ps1 as administrator in PowerShell 7 to easily add the default layout.

Читайте также:  С чего начинать установку linux

There are other layouts ( mini and flat at this moment).

Uninstall the menu items are also easy with uninstall.ps1 .

The Win-X Menu shortcuts are stored in %LOCALAPPDATA%\Microsoft\Windows\WinX and in the Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ShellCompatibility\InboxApp part of the registry, but the file explorer option is the one that really dictates what happens in the Win-X menu. I do not suggest just adding and changing stuff in the WinX folder because you could mess things up, however, the winaero.com/comment.php?comment.news.30 app in the link provides a way in which you wouldn’t mess it up. Either way, you should put «%programfiles%\WindowsApps\Microsoft.WindowsTerminal_0.11.1121.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe» in either a shortcut in the WinX folder, or in the app named accordingly.

Windows terminal context menu

Inspired from Windows terminal issue Add «open Windows terminal here» into right-click context menu #1060. Thanks to you all giants ❤

Windows terminal is an excellent terminal. But it does not offer a basic function which is right click context menu!
Without it, I have to cd to my working directory everytime. It’s inefficient.

So I wrote this script to deal with it.

  • Two layers of context menu
  • Auto parse settings.json to contruct menu
  • With uninstaller

Clone this repo git clone https://github.com/kerol2r20/Windows-terminal-context-menu

Run powershell (no need to get admin access right)

Change the execution policy Set-ExecutionPolicy Unrestricted -scope CurrentUser

Run SetupContextMenu.ps1 script

⚠️ If you find no item in your context menu, it may be caused by the old style profiles.json. You can delete %LocalAppData%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\profiles.json and restart Windows terminal. The new one will be generated. Ref to microsoft/terminal#4556

  1. Run SetupContextMenu.ps1 -uninstall:$true

This script will parse the settings.json file to generate menu items. However you can customize it.
Put any icon file into icon folder and modify the config.json like the following.

Config reference

  • global
    • extended[bool]: if set this to true, context menu will only show up when right click with shift
  • profiles
    • guid[string]: this GUID of your profile defined in settings.json
      • hidden[bool]: overwrites the visibility of the profile, if defined
      • icon[string]: filename of your ico file, you must put this file in icon folder
      • label[string]: context menu label
      • showRunAs[bool]: add run as administrator item for this profile

I’m not sure that icons file are legal or not. If you feel it is not ok, please tell me. Thanks.

About

📃 This is a simple script to add right click context menu for your best Windows terminal ❤

How to remove «Open in Windows Terminal» from context menu? #7008

Comments

4k3or3et commented Jul 22, 2020

how to remove «Open in Windows Terminal» from context menu?

I was looking into Registry but could not find anything.

What is the implementation of that feature?

The text was updated successfully, but these errors were encountered:

DHowett commented Jul 22, 2020

It can’t be removed right now. We’re tracking a workitem to only show it when SHIFT is held down.

Читайте также:  Lumia 630 windows 10 update

We’re not going to add the ability to delete it entirely. Sorry.

msftbot bot commented Jul 22, 2020

Hi! We’ve identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

vitaminj commented Jul 22, 2020 •

To remove this manually, open regedit, go to the folder \HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked (you may have to create the Blocked key) then add a string value on the right with the name <9f156763-7844-4dc4-b2b1-901f640f5155>and the value WindowsTerminal
Then restart Explorer.

Bookmark the folder if you’re likely to want to come back and re-enable the menu item when they add the option to only show it on holding shift

4k3or3et commented Jul 22, 2020

To remove this manually, open regedit, go to the folder \HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked (you may have to create the Blocked key) then add a string value on the right with the name <9f156763-7844-4dc4-b2b1-901f640f5155>and the value WindowsTerminal

Bookmark the folder if you’re likely to want to come back and re-enable the menu item when they add the option to only show it on holding shift

How to Add Open Windows Terminal Here Option to Right-click Menu

Alongside PowerShell, you can also add Windows Terminal to right-click menu. Follow these steps to add ‘Open Windows Terminal Here’ option.

Windows Terminal is what the users have been asking for years. A new terminal application that is fully customizable all the while being powerful and flexible. Thanks to the new tabbed interface, you can open multiple consoles of different types at the same time and work with them as needed. In fact, I’ve been using it as my main console ever since it was released.

When working with directories, it is very useful to open the terminal in that specific directory. This eliminates the need to manually open the terminal and then navigate to that folder using multiple cd commands. Unfortunately, as of writing this, Windows Terminal has no such option. You are stuck with the old “Open PowerShell window here” option. Thankfully, you can add your own “Open Windows Terminal Here” option to the right-click menu in just a few steps.

Without ado, follow the below steps to add an open Windows Terminal here option to the right-click context menu in Windows 10.

Add Open Windows Terminal Here Option to Right-click Menu

1. First, we need to set the default directory in Windows Terminal. To do that, open Windows Terminal, click on the drop-down button on the title bar and select “Settings“. In the JSON file, add the below line to your default profile.

If you are curious, we are adding this line because without it, when you open Windows Terminal from the right-click menu, it will open in your home directory rather than in the current directory.

2. Now, right-click on the desktop and select “New → Text Document” to create a new text file. Name the text file as “wt.reg“. This action converts the text file into the reg file.

3. Next, right-click on the newly created file and select “Edit“.

4. The above action will open the file in the default text editor. Here, copy and paste the below code in it. Don’t forget to replace “ ” with your actual Windows username. Save the file by pressing Ctrl + S or selecting “File → Save“.

5. Now, close the file and double-click on it. You will be prompted whether you want to merge the reg file. Click on the “Yes” button and then the “Ok” button.

That is it. From now on, whenever you Shift + Right-click in a directory or folder, you will see the new “Open Windows Terminal here” option in the right-click menu.

Selecting the option will open Windows Terminal in that directory.

(Optional) Add Icon to the Option

If you are willing to go the extra mile, you can add a little icon right before the option in the right-click menu. This is just eye candy and you can ignore it if you are not interested.

1. Download this official Windows Terminal icon.

2. After downloading, open the Run dialog box by pressing Win + R shortcut. In the blank field, copy and paste the below path and press Enter.

3. In this folder, right-click and select “New → Folder” to create a new folder. Name the folder as “WTerminal“.

4. Now, copy the icon to the newly created folder.

5. Next, open the “Registry Editor” by searching for it in the start menu. In the Registry Editor, go to the following folder.

6. Right-click on the right-panel and select the “New → String Value” option. Name the value as “Icon“.

7. Double-click on the “Icon” value. In the value data field, copy and paste the below path and click on the “Ok” button.

That is it. Close the registry editor. From now on, you should also see the terminal icon right next to the “Open Windows Terminal here” option.

I hope that helps. If you are stuck or need some help, comment below and I will try to help as much as possible.

Оцените статью