如何在 Windows 上添加自定义 url 处理程序。喜欢 iTunes itms://

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/796748/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 06:17:43  来源:igfitidea点击:

How can I add a custom url handler on Windows. Like iTunes itms://

windowsurlshellprotocol-handler

提问by Jan Bannister

I would like telnet://blah to open putty and not the native windows telnet client.

我希望 telnet://blah 打开腻子而不是本机 Windows telnet 客户端。

I don't even know what this 'feature' is called under windows so I'm having no luck find any information about it.

我什至不知道在 Windows 下这个“功能”被称为什么,所以我没有运气找到任何关于它的信息。

Thanks in advance, Jan

提前致谢,简

采纳答案by Richard Szalay

If it's simple, you can do it via the command line:

如果它很简单,您可以通过命令行来完成:

ftype telnet # view current binding
ftype telnet=\path\to\putty.exe %1

Otherwise you'll need to use the registry as previously posted.

否则,您将需要使用之前发布的注册表。

回答by Chris S

It's a registry keys that provides the custom URI handlers.

它是一个提供自定义 URI 处理程序的注册表项。

Here's an article on it on MSDN, to quote some of it:

这是 MSDN 上的一篇文章,引用其中的一些内容:

HKEY_CLASSES_ROOT
     alert
          (Default) = "URL:Alert Protocol"
          URL Protocol = ""
          DefaultIcon
               (Default) = "alert.exe"
          shell
               open
                    command
                         (Default) = "C:\Program Files\Alert\alert.exe" "%1"

That would you allow to do

你会允许这样做吗

alert:some message

警报:一些消息

And your application would obviously receive the "some message" as its argument.

并且您的应用程序显然会收到“一些消息”作为其参数。

回答by Jason Musgrove

To change the telnet: protocol handler (or any other existinghandler) on XP (may work for Vista - I haven't looked), go to Control Panel > Folder Options > File Types (Tab). Scroll down (not much, it's near the top) to find (NONE) URL:Telnet Protocol, and hit the "Advanced" button. From here on in, it's just like changing a file type association. Note that the target application needs to support the passing of the supplied URL as a parameter.

要更改XP 上的 telnet: 协议处理程序(或任何其他现有处理程序)(可能适用于 Vista - 我没有看过),请转到控制面板 > 文件夹选项 > 文件类型(选项卡)。向下滚动(不多,靠近顶部)找到 (NONE) URL:Telnet 协议,然后点击“高级”按钮。从现在开始,这就像更改文件类型关联一样。请注意,目标应用程序需要支持将提供的 URL 作为参数传递。

Unfortunately, the "New" button doesn't seem to allow the creation of new "URL" types, as it requires the entry of an extension. To create a new one, I've previously had to copy an existing entry from the registry (that is: find, export, edit in text editor, and re-import).

不幸的是,“新建”按钮似乎不允许创建新的“URL”类型,因为它需要输入扩展名。要创建一个新条目,我以前必须从注册表中复制现有条目(即:查找、导出、在文本编辑器中编辑和重新导入)。

回答by user3568910

You can use following script: https://gist.github.com/sbiffi/11256316

您可以使用以下脚本:https: //gist.github.com/sbiffi/11256316

It associates telnet:// and ssh:// URLs to a script which parses the parameters in the URL and launches putty.

它将 telnet:// 和 ssh:// URL 关联到一个脚本,该脚本解析 URL 中的参数并启动 putty。

No need to change putty It also supports passing login (and password for ssh).

无需更改 putty 它还支持传递登录名(以及 ssh 的密码)。