4

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"

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.

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

Marco Righele
  • 2,702
  • 3
  • 23
  • 23

2 Answers2

3

You could use VBS?

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

Using

if wscript.arguments.length > 0 then
     wscript.createobject( "WScript.Shell" ).run("app.exe " & wscript.arguments(0))
end if
Alex K.
  • 171,639
  • 30
  • 264
  • 288
  • I'm not sure that we can (have to investigate that), but anyway it seems to be the only alternative to external programs. – Marco Righele Mar 19 '14 at 09:07