首页 > 解决方案 > Custom URL Protocol with arguments is looking for the arguments inside Mozilla's directory

问题描述

I have a Custom URL Protocol to open Notepad++. In the browser when I type

notepad++:C:\test.txt

Notepad++ opens but the file does not open. Instead I get this error

"C:\Program Files (x86)\Mozilla Firefox\notepad++:C:\test.txt cannot be opened"

I get a similar error in Google Chrome too.

Here is my registry entry.

enter image description here

标签: htmlfirefoxbrowserregistry

解决方案


根据设计,自定义 URL 协议将整个协议作为参数传递,整个字符串“notepad++:C:\test.txt”被传递给应用程序。Firefox 的错误是因为参数不是完全限定的文件路径,它正在浏览器的工作目录中查找文件。解决这个问题的方法是解析掉“notepad++:”,例如使用脚本,然后让脚本使用正确的参数启动 notepad++。


推荐阅读