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

混淆者
混淆者· 2020年07月11日 本文共计3236字|已被浏览625次

将 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 上搜索该方案的时候找到了 此项目

    • 此项目无法正常安装,没有图标文件,在有空格的文件路径下也无法正常打开
缘起,在人群中,我看见你。缘灭,我看见你,在人群中。----《其他》