注册打开应用的协议
新建一个文本文档,拷贝如下内容,保存****.reg文件
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\copyFilePath]
"URL Protocol"=""
@="copyFilePath"
[HKEY_CLASSES_ROOT\copyFilePath\shell]
[HKEY_CLASSES_ROOT\copyFilePath\shell\open]
[HKEY_CLASSES_ROOT\copyFilePath\shell\open\command]
@="\"G:\\TASK\\我是中文\\testDemo\\copyFilePath.exe\" \"%1\""
因为写了中文目录,保存时使用ANSI编码格式保存
双击执行注册。
注册表里就有了以下内容
网页调用
如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<button onclick="kkk()">click</button>
<a href="copyFilePath://">copyFilePath</a>
</body>
<script>
function kkk(){
window.location.href="copyFilePath://";
}
</script>
</html>