启动.BAT从自定义URL处理程序文件而不显示控制台窗口 [英] Launch .bat files from a custom URL handler without showing the console window

查看:526
本文介绍了启动.BAT从自定义URL处理程序文件而不显示控制台窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注册Windows中的一个自定义的处理器,为了能够从一个URL启动本地程序。继MSND文档,我插在注册表中的以下值:

I registered a custom URL handler in Windows, in order to be able to launch a local program from an URL. Following the MSND documentation, I inserted the following values in the Registry:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\TestLaunch]
@="URL:TestLaunch Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\TestLaunch\DefaultIcon]
@="\"c:\\temp\\test.bat\""

[HKEY_CLASSES_ROOT\TestLaunch\shell]

[HKEY_CLASSES_ROOT\TestLaunch\shell\open]

[HKEY_CLASSES_ROOT\TestLaunch\shell\open\command]
@="\"c:\\temp\\test.bat\" %1"

这个工作,但是当我点击 TestLaunch:链接和批处理文件开始,我可以看到控制台窗口出现。由于批处理文件的作用只是解析参数的URL并启动其他应用程序,我想控制台不出现(或至少是最小化),哪怕只是一秒钟的一小部分。

This works, but when I click a TestLaunch: link and the batch file starts I can see the console windows appearing. Since the role of the batch file is just parsing the argument url and launching another application, I would like the console non to appear (or at least being minimized), even if it is just for a fraction of a second.

这是来到了我的脑海里的唯一的事情是创建一个链接到该批处理文件( test.bat.lnk ),并将其设置为启动为最小化,但韩元'T的工作。
任何其他的想法?我打开替代的批处理文件,但我想坚持一下Windows提供了

The only thing that came to my mind is creating a link to the batch file (test.bat.lnk) and set it to start as minimized, but that won't work. Any other ideas ? I'm open to an alternative to batch files, but I'd like to stick to what Windows provides

推荐答案

您可以用VBS?

@="\"WSCRIPT c:\\temp\\test.vbs\" %1"

使用

if wscript.arguments.length > 0 then
     wscript.createobject( "WScript.Shell" ).run("app.exe " & wscript.arguments(0))
end if

这篇关于启动.BAT从自定义URL处理程序文件而不显示控制台窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆