创建自定义协议(Windows 7) [英] Creating Custom Protocol (Windows 7)
问题描述
我一直在尝试创建自定义协议(open_php_file://),以通过浏览器打开本地文件.我创建了以下注册密钥:
I've been trying to create a custom protocol (open_php_file://) to open local files through the browser. I've created the following registery-keys:
HKEY_CLASSES_ROOT
open_php_file
(Default) = "URL:PHPEd protocol"
URL Protocol = ""
DefaultIcon
(Default) = "phped.exe"
shell
open
command
(Default) = "C:\Program Files (x86)\NuSphere\7.0\phped.exe" "%1"
问题是:我无法在浏览器中打开文件(例如:open_php_file://c:\ file.txt),并且该协议未在Windows默认程序中列出.
The problem is: I can't open files in my browser (example: open_php_file://c:\file.txt), and the protocol isn't listed in the windows default programms.
推荐答案
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\openphpfile]
@="\"URL:openphpfile Protocol\""
"EditFlags"=hex:02,00,00,00
"URL Protocol"=""
[HKEY_CLASSES_ROOT\openphpfile\DefaultIcon]
@="\"C:\\Users\\ABC\\Documents\\Programs\\CB\\Chunks\\CGI.exe\",0"
[HKEY_CLASSES_ROOT\openphpfile\shell]
[HKEY_CLASSES_ROOT\openphpfile\shell\open]
[HKEY_CLASSES_ROOT\openphpfile\shell\open\command]
@="\"C:\\Users\\ABC\\Documents\\Programs\\CB\\Chunks\\CGI.exe\" -c \"%1\""
基本上,问题出在协议中的下划线.一旦删除,一切都开始正常运行.您可以根据需要更改可执行文件的路径,即"C:\ Program Files(x86)\ NuSphere \ 7.0 \ phped.exe .
Basically the problem was with the underscores in your protocol.Once removed everything started working fine.You can change the path of executable as per your wish i.e. "C:\Program Files (x86)\NuSphere\7.0\phped.exe".
我尝试了openphpfile:blast
,效果很好:)
I tried openphpfile:blast
and it worked quite nicely :)
此解决方案的问题是%1被替换为 "open_php_file://[file]",而不仅仅是"[file]".这样我需要 可以过滤"open_php_file://"的某种过滤器.
the problem with this solution is that %1 gets replaced with "open_php_file://[file]" instead of just "[file]". This way I need some sort of filter that chops "open_php_file://".
在openphpfile之后放置一个空格:[空格]您的内容并将参数更改为%2,您将获得预期的结果
put a space after openphpfile:[Space]Your_Content and change parameter to %2 you will get the expected result
[HKEY_CLASSES_ROOT\openphpfile\shell\open\command]
@="\"C:\\Users\\ABC\\Documents\\Programs\\CB\\Chunks\\CGI.exe\" -c \"%2\""
这篇关于创建自定义协议(Windows 7)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!