oracle 调用exe,浏览器调用exe,bat等本地程序

参考文章:https://blogs.msdn.microsoft.com/ieinternals/2011/07/13/understanding-protocols/

浏览器调用客户端的程序。(以调用secureCRT为例)

以下内容创建注册表:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\yourname]

@="Url:yourname Protocol"

"URL Protocol"="D:\\Program Files\\SecureCRT\\SecureCRT.exe"

"UseOriginalUrlEncoding"=dword:00000001

[HKEY_CLASSES_ROOT\yourname\DefaultIcon]

@="D:\\Program Files\\SecureCRT\\SecureCRT.exe,1"

[HKEY_CLASSES_ROOT\yournamet\shell]

[HKEY_CLASSES_ROOT\yourname\shell\open]

[HKEY_CLASSES_ROOT\yourname\shell\open\command]

@="\"D:\\Program Files\\SecureCRT\\SecureCRT.exe\" \"%1\""

页面调用的时候写:

注意注册表的这一句:

@="\"D:\\Program Files\\SecureCRT\\SecureCRT.exe\" \"%1\""

有些blog的说明:%1是去掉自定义协议头的参数部分。比如示例中的页面代码,%1 是去掉  yourname:// 留下的  “/param1”

但是,个人测试结果:传递的是yourname:///param1也就是整个URL,而且ff、chrome,还对url进行了urlEncode,空格转化为%20

(注册表里的UseOriginalUrlEncoding = 1,起的作用是能让encode采取统一的格式,详细说明请参见篇头的文章)

好~~问题来了:

比如调用 SecureCRT.exe /SSH2 /L root /P 22 /PASSWORD xxxxx 1.1.1.1

SecureCRT.exe  yourname:///SSH2 /L root /P 22 /PASSWORD xxxxx 1.1.1.1

或者

SecureCRT.exe  yourname:///SSH2%20/L%20root%20/P%2022%20/PASSWORD%20xxxxx%201.1.1.1

我的办法是写了一个bat,注册表指向它,他再解析参数,调用secureCRT

有没有更好的方法?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值