联系 订阅 管理 sublime text 3-right click context menu

简介:

dd a system wide windows explorer button " Edit with Sublime" similar to how Notepad++ does it or some other editors?
See attached screenshot.fd6ebd92a3d2c81fc9ff2967d1b58978.jpg

(I know this is an old thread, but since I dropped by looking for the same information and found it elsewhere, so here goes.)
If you've installed Sublime from the zip, follow the instructions from
http://www.howtogeek.com/107965/how-to-add-any-application-shortcut-to-windows-explorers-context-menu/ 
Scroll down to 'chapter' by the name 'All file types'.
Taking the above page's guide as an example, you can add a shortcut key to the context menu item by adding the text you like to 'Open with Nodepad' -key's (Default) string.
Here's my setup as exported from regedit:

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:\\apps\\tools\\sublime_text.exe \"%1\""

 

batch fie from this site:https://gist.github.com/jcppkkk/8330314

 

复制代码
@echo off
@rem ==================
@rem Source:  
@rem     https://gist.github.com/jcppkkk/8330314
@rem Description: 
@rem     Install context menu to allow user opens file with Sublime Text as User or Admin, or Open Folder with Sublime Text.
@rem Usage:
@rem     Download this .bat file to in Sublime Text's installation folder.
@rem     Execute this batch file. It will download elevate codes and setup context menu.
@rem ==================
@rem \"%stPath%\"   : Path to Sublime Text installation dir.
@rem %entryName%: Key name for the registry entry.
@rem %menuText% : Context menu text. Set your preferred menu text (e.g.: translate to your language).
@rem %entryNameAsAdmin%: Key name for the registry entry.
@rem %menuTextAsAdmin% : Context menu text. Set your preferred menu text for administrator privilege (e.g.: translate to your language).
 
SET stPath=%~dp0sublime_text.exe
SET entryName=Sublime Text
SET menuText=Open with Sublime Text
SET entryNameAsAdmin=Sublime Text As Admin
SET menuTextAsAdmin=Open with Sublime Text As Admin
SET elevate.CmdPath=%~dp0__elevate.cmd
SET elevate.VbsPath=%~dp0__elevate.vbs
 
echo # Administrative permissions required. Detecting permissions...
call :check_Permissions
 
echo # add it for all file types
reg add "HKEY_CLASSES_ROOT\*\shell\%entryName%"         /t REG_SZ /v "" /d "%menuText%"   /f
reg add "HKEY_CLASSES_ROOT\*\shell\%entryName%"         /t REG_EXPAND_SZ /v "Icon" /d "\"%stPath%\",0" /f
reg add "HKEY_CLASSES_ROOT\*\shell\%entryName%\command" /t REG_SZ /v "" /d "\"%stPath%\" \"%%1\"" /f
 
echo # Download elevate scripts
call :download "https://gist.github.com/jcppkkk/8330314/raw/3d863b0d5de7b47cb177f0571ffa232d27a3869e/__elevate.cmd" "%elevate.CmdPath%"
call :download "https://gist.github.com/jcppkkk/8330314/raw/2b89b316d6af469db513a02d156c9a315d684fd0/__elevate.vbs" "%elevate.VbsPath%"
 
echo # add it for all file types as admin
reg add "HKEY_CLASSES_ROOT\*\shell\%entryNameAsAdmin%"         /t REG_SZ /v "" /d "%menuTextAsAdmin%"   /f
reg add "HKEY_CLASSES_ROOT\*\shell\%entryNameAsAdmin%"         /t REG_EXPAND_SZ /v "Icon" /d "\"%stPath%\",0" /f
reg add "HKEY_CLASSES_ROOT\*\shell\%entryNameAsAdmin%\command" /t REG_SZ /v "" /d "\"%elevate.CmdPath%\" \"%stPath%\" \"%%1\"" /f
 
echo # add it for folders
reg add "HKEY_CLASSES_ROOT\Folder\shell\%entryName%"         /t REG_SZ /v "" /d "%menuText%" /f
reg add "HKEY_CLASSES_ROOT\Folder\shell\%entryName%"         /t REG_EXPAND_SZ /v "Icon" /d "\"%stPath%\",0" /f
reg add "HKEY_CLASSES_ROOT\Folder\shell\%entryName%\command" /t REG_SZ /v "" /d "\"%stPath%\" \"%%1\"" /f
pause
goto :EOF
 
 
:check_Permissions
net session >nul 2>&1
if %errorLevel% == 0 (
    echo Administrative permissions confirmed.
    goto :EOF
) else (
    echo Failure: Current permissions inadequate.
    echo You will need to "Run as Administrator" if using Vista/Win7/Win8.
    pause >nul
    exit
)
goto :EOF
 
 
:download 
@"C:\Windows\System32\WindowsPowerShell\v1.0\powershell" "$wc = New-Object System.Net.WebClient;$wc.DownloadFile('%1', '%2')"
@echo %2
@goto :EOF
复制代码



本文转自hcy's workbench博客园博客,原文链接:http://www.cnblogs.com/alterhu/p/3986781.html,如需转载请自行联系原作者。


目录
相关文章
Element el-button 按钮组件详解
本文目录 1. 背景 2. 按钮分类 3. 按钮样式 4. 按钮状态 5. 按钮分组 6. 按钮尺寸 7. 小结
2404 0
Element el-button 按钮组件详解
|
1月前
|
小程序 前端开发
【微信小程序】-- 常用的基础内容组件介绍 -- text & rich-text & progress & icon(七)
【微信小程序】-- 常用的基础内容组件介绍 -- text & rich-text & progress & icon(七)
|
5月前
|
JavaScript
Element UI报错:Unknown custom element: <el-menu>
Element UI报错:Unknown custom element: <el-menu>
47 0
|
6月前
|
C#
C#用代码创建的Button大小为什么不对?
C#用代码创建的Button大小为什么不对?
|
9月前
HTML中<button />和<input type=“button“/>的区别
HTML中<button />和<input type=“button“/>的区别
52 0
|
小程序 前端开发 容器
【微信小程序】常用组件基本使用(view/scroll-view/swiper、text/rich-text、button/image)
【微信小程序】常用组件基本使用(view/scroll-view/swiper、text/rich-text、button/image)
155 0
|
存储 缓存 安全
为什么不能使用 Application Context 显示 Dialog?
为什么不能使用 Application Context 显示 Dialog?
为什么不能使用 Application Context 显示 Dialog?
PyQt5 技术篇-设置输入框的placeholder方法,Qt Designer设置Line Edit、Text Edit编辑框的placeholder
PyQt5 技术篇-设置输入框的placeholder方法,Qt Designer设置Line Edit、Text Edit编辑框的placeholder
544 0
PyQt5 技术篇-设置输入框的placeholder方法,Qt Designer设置Line Edit、Text Edit编辑框的placeholder
BSP UI Workbench double click component and see view list
BSP UI Workbench double click component and see view list
BSP UI Workbench double click component and see view list
SAP UI5 click list item to navigate to detail page
Created by Wang, Jerry, last modified on Mar 23, 2015
78 0
SAP UI5 click list item to navigate to detail page