【问题标题】:Sublime Text 2 Context Menu in Windows 8Windows 8 中的 Sublime Text 2 上下文菜单
【发布时间】:2023-03-12 02:15:02
【问题描述】:

您可能知道,Windows 8 昨天问世。我已经升级了,一切似乎都运行良好,但是当我为我的代码编辑器安装 Sublime Text 2 时,上下文菜单中曾经显示“使用 Sublime Text 2 编辑”的按钮不再存在。我曾尝试使用自定义注册表脚本,它会添加按钮,但 Windows 8 仍然 询问我想用什么程序打开它。这是我使用的脚本:

(另存为add_context_menu.reg)

Windows Registry Editor Version 5.00


[HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2]

@="Open with S&ublime Text 2"

[HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2\command]

@="C:\Program Files\Sublime Text 2\sublime_text.exe \"%1\""

有什么帮助吗?

【问题讨论】:

    标签: registry editor contextmenu


    【解决方案1】:

    我在Windows 8 中使用Sublime Text 2 并且Open with Sublime Text 2 按钮没有问题,实际上我使用它打开了.reg :)

    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2]
    
    [HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2\command]
    @="C:\\Program Files\\Sublime Text 2\\sublime_text.exe \"%1\""
    

    我猜你没有转义反斜杠这一事实可能是问题所在

    【讨论】:

    • 请注意,当您安装 Sublime Text 并允许安装程序添加上下文菜单时,它会创建没有转义反斜杠的注册表项。也许这是安装程序中的错误?
    【解决方案2】:

    在这里,您可以找到两个非常详细且注释良好的 Windows 上下文菜单 .reg 文件。一个用于版本 2,另一个用于 Sublime Text 的版本 3。

    https://github.com/cbmeeks/sublime-text-2-context-menu-windows

    【讨论】:

      【解决方案3】:

      在 Windows 8 上,以下代码对我有用

      C:\Program Files\Sublime Text 2\sublime_text.exe "%1"

      【讨论】:

        【解决方案4】:

        这是一个更好的命令。只需将其保存到 app 目录中的 bat 文件并以管理员身份运行即可。

        您可以将此命令用于其他应用程序,例如 Atom、VSCode、... 只需更改 App* 行

        @echo off
        SET AppKey=SublimeText3
        SET AppTitle=Open with Sublime Text 3
        SET AppPath=%~dp0sublime_text.exe
        SET AppIcon=%AppPath%,0
        
        REG ADD "HKEY_CLASSES_ROOT\*\shell\%AppKey%" /ve /f /d "%AppTitle%"
        REG ADD "HKEY_CLASSES_ROOT\*\shell\%AppKey%" /v "Icon" /f /d "%AppIcon%"
        REG ADD "HKEY_CLASSES_ROOT\*\shell\%AppKey%\command" /ve /f /d "%AppPath% \"%%1\""
        
        REG ADD "HKEY_CLASSES_ROOT\Folder\shell\%AppKey%" /ve /f /d "%AppTitle%"
        REG ADD "HKEY_CLASSES_ROOT\Folder\shell\%AppKey%" /v "Icon" /f /d "%AppIcon%"
        REG ADD "HKEY_CLASSES_ROOT\Folder\shell\%AppKey%\command" /ve /f /d "%AppPath% \"%%v\""
        
        REG ADD "HKEY_CLASSES_ROOT\Directory\Background\shell\%AppKey%" /ve /f /d "%AppTitle%"
        REG ADD "HKEY_CLASSES_ROOT\Directory\Background\shell\%AppKey%" /v "Icon" /f /d "%AppIcon%"
        REG ADD "HKEY_CLASSES_ROOT\Directory\Background\shell\%AppKey%\command" /ve /f /d "%AppPath% \"%%v\""
        

        【讨论】:

          猜你喜欢
          • 2014-10-13
          • 2013-08-20
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2012-10-20
          • 2014-02-10
          • 1970-01-01
          相关资源
          最近更新 更多