DEV Community

Aravind Reddy V
Aravind Reddy V

Posted on

Open Windows Terminal with Right Click

In this post I would like to show you how to add an Open Terminal here entry to Right-Click menu in Windows.

Open Terminal Here

First, download the new Windows Terminal. It is awesome!

Also, you can get a script to run all the commands for you here: https://github.com/zeroby0/open-terminal-here

Download the Windows Terminal icon

Open a new Terminal window and type these commands to download a high resolution icon to show in the menu.

$ICON_URL  = "https://raw.githubusercontent.com/zeroby0/open-terminal-here/master/wt.ico"
$ICON_PATH = "$env:LOCALAPPDATA\wt_terminal"
$WT_PATH   = "$env:LOCALAPPDATA\Microsoft\WindowsApps\wt.exe"

# Download icon
New-Item -ItemType "directory" -Path    "$ICON_PATH"
Invoke-WebRequest  "$ICON_URL" -OutFile "$ICON_PATH\wt.ico"
Enter fullscreen mode Exit fullscreen mode

Registry keys for folders

Now let's add some registry entries. You can now click on a folder and open terminal there.

# Add entry on folders
$REG_PATH = "HKCU:\Software\Classes\Directory\shell\wt_terminal"
New-Item -Path $REG_PATH -Value "Open in Terminal" -Force
New-Item -Path "$REG_PATH\command" -Value "$WT_PATH -d `"%V%`"" -Force
New-ItemProperty -Path $REG_PATH -Name "Icon" -Value "$ICON_PATH\wt.ico"
Enter fullscreen mode Exit fullscreen mode

Registry keys inside folders

To open Terminal inside a folder by clicking on the Explorer background, run the following commands.

# Add entry inside folders
$REG_PATH = "HKCU:\Software\Classes\Directory\Background\shell\wt_terminal"
New-Item -Path $REG_PATH -Value "Open Terminal here" -Force
New-Item -Path "$REG_PATH\command" -Value "$WT_PATH -d `"%V%`"" -Force
New-ItemProperty -Path $REG_PATH -Name "Icon" -Value "$ICON_PATH\wt.ico"
Enter fullscreen mode Exit fullscreen mode

Conclusion

Aand that's it! It should work on all the recent builds on Windows 10. But if it doesn't work for you, let me know in the comments below and I'll try to help. 🙂

Discussion (1)

Collapse
brummgrammierer profile image
Marcus Mangelsdorf

Thank you for this helpful tutorial! 🙏

I manually followed your steps using RegEdit and I found that there might be a typo, namely an excess percent sign (%) after the %V part.

So at least when adding the keys manually, the resulting value in the command key should be wt.exe -d "%V" instead of wt.exe -d "%V%".

Hope this helps other crazy people that follow along in RegEdit ^^