联系 订阅 管理 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,如需转载请自行联系原作者。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值