注册表的语法可以看下:https://www.cnblogs.com/fczjuever/archive/2013/04/09/3010711....

无参情况:其实是有一个exe的绝对路径:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Test1]
"URL Protocol"=""
@="Test1 Protocol"

[HKEY_CLASSES_ROOT\Test1\DefaultIcon]
@="C:\\Users\\Administrator\\Desktop\\test.exe"

[HKEY_CLASSES_ROOT\Test1\shell]
@=""

[HKEY_CLASSES_ROOT\Test1\shell\open]
@=""

[HKEY_CLASSES_ROOT\Test1\shell\open\command]
@="\"C:\\Users\\Administrator\\Desktop\\test.exe\" "

解释:

Windows Registry Editor Version 5.00//注册表版本信息

[HKEY_CLASSES_ROOT\Test1] //Test1协议名称
"URL Protocol"=""
@="Test1 Protocol"

[HKEY_CLASSES_ROOT\Test1\DefaultIcon]//Test1协议名称
@="C:\\Users\\Administrator\\Desktop\\test.exe" //exe路径

[HKEY_CLASSES_ROOT\Test1\shell]//Test1协议名称
@=""

[HKEY_CLASSES_ROOT\Test1\shell\open]//Test1协议名称
@=""

[HKEY_CLASSES_ROOT\Test1\shell\open\command]//Test1协议名称
@="\"C:\\Users\\Administrator\\Desktop\\test.exe\" "//exe路径

验证:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
    
<form>
<a href="Test1://123456//4567897//1564684//454565" >Document</a> 
</form>
    
</body>
</html>

有多个参数的情况....具体我也不是很清楚

但是网上有看到传递一个参数的方法,可以变相这么考虑,

自己自定义分隔符,将所有的参数扔到这里面来....获取到参数...

再对其进行解析,得到多个参数

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Test]
"URL Protocol"=""
@="Test Protocol"


[HKEY_CLASSES_ROOT\Test\DefaultIcon]
@="C:\\Users\\Administrator\\Desktop\\test.exe"


[HKEY_CLASSES_ROOT\Test\shell]
@=""

[HKEY_CLASSES_ROOT\Test\shell\open]
@=""

[HKEY_CLASSES_ROOT\Test\shell\open\command]
@="\"C:\\Users\\Administrator\\Desktop\\test.exe\" \"%1\" "

在最后一个多了一个\"%1\" 1个参数的意思

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
    
<form>
<a href="Test://123456//4567897//1564684//454565" >Document</a> 
</form>
    
</body>
</html>

其实那个Test:是指注册表我们添加的名字冒号别丢了....为什么...我试的

test.cpp

#include<stdio.h>
#include<stdlib.h> 
int main(int argc,char *argv[])
{
    int i = 0;
    for (i = 0; i < argc; i++)
    {
        printf("%d: %s\n", i + 1, argv[i]);
    }
    system("pause");
    return 0;
}

得到结果:
继续尝试....

发现

@="\"C:\Users\Administrator\Desktop\test.exe\" \"%1\" \"%2\" \"%3\" \"%4\""
这边多了一些"%1","%2"......

真的多了参数!!!!


xxnobug
34 声望1 粉丝