Skip to content

Instantly share code, notes, and snippets.

@winse
Created July 21, 2014 06:37
Show Gist options
  • Save winse/4548d6c182f8162497fa to your computer and use it in GitHub Desktop.
Save winse/4548d6c182f8162497fa to your computer and use it in GitHub Desktop.
url-editable, 注册自定义的url-protocol
@echo off
rem npp-windows app...
rem http://stackoverflow.com/questions/636381/what-is-the-best-way-to-do-a-substring-in-a-batch-file
set fileRelativePath=%1
set filepath="%~dp0..\..\%fileRelativePath:~17,-1%"
start E:\local\usr\share\npp\notepad++.exe %filepath%
rem pause
exita
@echo off
rem npp-windows redirect...
rem "C:\Users\Administrator\AppData\Local\Google\Chrome\User Data\Local State" /protocol_handler
@echo on
set NPP_APP=%~dp0npp-windows.bat
set NPP_ARG=%%1
set "NPP_CMD=\"%NPP_APP%\" \"%NPP_ARG%\""
rem set "NPP_CMD=mshta vbscript:createobject(\"wscript.shell\").run(\"\"\"%NPP_APP%\"\" \"\"%NPP_ARG%\"\"\",1)(window.close)&&exit "
reg add "HKEY_CLASSES_ROOT\npp-windows" /f
reg add "HKEY_CLASSES_ROOT\npp-windows" /ve /t REG_SZ /d "URL:npp-windows Protocol" /f
reg add "HKEY_CLASSES_ROOT\npp-windows" /v "URL Protocol" /t REG_SZ /d "" /f
reg add "HKEY_CLASSES_ROOT\npp-windows\DefaultIcon" /f
reg add "HKEY_CLASSES_ROOT\npp-windows\DefaultIcon" /ve /t REG_SZ /d "" /f
reg add "HKEY_CLASSES_ROOT\npp-windows\shell" /f
reg add "HKEY_CLASSES_ROOT\npp-windows\shell\open" /f
reg add "HKEY_CLASSES_ROOT\npp-windows\shell\open\command" /f
reg add "HKEY_CLASSES_ROOT\npp-windows\shell\open\command" /ve /t REG_SZ /d "%NPP_CMD%" /f
pause

usage:

<a href="npp-windows://e/_posts/2014-01-20-weinra-remote-inspect.md">npp blog/_posts/2014-01-20-weinra-remote-inspect.md</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment