将Windows Terminal添加到右键菜单的最简方式

Author Avatar
混淆者· 7月11日 本文共计3236字|已被浏览154次
  • 在其它设备中阅读本文章

将Windows Terminal添加到右键菜单的最简方式


效果演示

效果图


操作步骤

1. 保存以下文件到任意位置的WindowsTerminalHere.inf

; "Windows Terminal" PowerToy

[version]
signature="$CHICAGO$"

[WindowsTerminalHereInstall]
CopyFiles = WindowsTerminalHere.Files.Inf
AddReg    = WindowsTerminalHere.Reg

[DefaultInstall]
CopyFiles = WindowsTerminalHere.Files.Inf
AddReg    = WindowsTerminalHere.Reg

[DefaultUnInstall]
DelFiles  = WindowsTerminalHere.Files.Inf
DelReg    = WindowsTerminalHere.Reg

[SourceDisksNames]
55="Windows Terminal Here","",1

[SourceDisksFiles]
WindowsTerminalHere.INF=55

[DestinationDirs]
WindowsTerminalHere.Files.Inf = 17

[WindowsTerminalHere.Files.Inf]
WindowsTerminalHere.INF

[WindowsTerminalHere.Reg]
HKLM,%UDHERE%
HKLM,%UDHERE%,DisplayName,,"%WindowsTerminalHereName%"
HKLM,%UDHERE%,UninstallString,,"rundll32.exe syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %17%\WindowsTerminalHere.inf"
HKCR,Directory\Shell\WindowsTerminalHere
HKCR,Directory\Shell\WindowsTerminalHere,,,"%WindowsTerminalHereAccel%"
HKCR,Directory\Shell\WindowsTerminalHere,Icon,,"%WindowsTerminalHereIcon%"
HKCR,Directory\Shell\WindowsTerminalHere\command,,0x00020000,""%%LOCALAPPDATA%%\Microsoft\WindowsApps\wt.exe  -d """%1"""  ""
HKCR,Directory\Background\Shell\WindowsTerminalHere
HKCR,Directory\Background\Shell\WindowsTerminalHere,,,"%WindowsTerminalHereAccel%"
HKCR,Directory\Background\Shell\WindowsTerminalHere,Icon,,"%WindowsTerminalHereIcon%"
HKCR,Directory\Background\Shell\WindowsTerminalHere\command,,0x00020000,""%%LOCALAPPDATA%%\Microsoft\WindowsApps\wt.exe  -d """%V"""  ""
HKCR,Drive\Shell\WindowsTerminalHere
HKCR,Drive\Shell\WindowsTerminalHere,,,"%WindowsTerminalHereAccel%"
HKCR,Drive\Shell\WindowsTerminalHere,Icon,,"%WindowsTerminalHereIcon%"
HKCR,Drive\Shell\WindowsTerminalHere\command,,0x00020000,""%%LOCALAPPDATA%%\Microsoft\WindowsApps\wt.exe  -d """%1"""  ""

[Strings]
WindowsTerminalHereName="Open Wtih Windows Terminal"
WindowsTerminalHereAccel="Open Windows Terminal Here"
UDHERE="Software\Microsoft\Windows\CurrentVersion\Uninstall\WindowsTerminalHere"
WindowsTerminalHereIcon=""%LOCALAPPDATA%/terminal/terminal.ico",0"

2. 添加图标文件

  1. 在资源管理器中输入%LOCALAPPDATA%打开如下页面:

    • %LOCALAPPDATA%页面
  2. 新建一个terminal文件夹
  3. 打开terminal文件夹,将以下图标另存为terminal.ico放置到此目录下

    • 右键另存为此图标

3. 安装!

  • 右键刚刚保存的WindowsTerminalHere.inf,选择安装

    • 安装菜单
  • 可能会出现如下图所示的UAC授权界面,确定即可

    • UAC授权

4. 完成!

  • 安装步骤完成后,在文件夹中右键即可看到Open Windows Terminal Here选项

    • 效果图

探究步骤

  • 基于GitHub提供的源码修改
  • 我在Github上搜索该方案的时候找到了此项目

    • 此项目无法正常安装,没有图标文件,在有空格的文件路径下也无法正常打开

本文链接:https://blog.mnixry.cn/Technology/easiest-way-add-windows-terminal-to-rightclick-menu.html
该博客遵守 CC BY-NC-SA 4.0 协议

牛肉面算是我的人生菜单,很高兴有一天,我终于学会了你的味道。----《日食记》