Search code examples
windowsregistry

Why parameters pass wrong registry Windows


I registred protocol in registry Windows

REGEDIT4

[HKEY_CLASSES_ROOT\vnc]
@="URL:VNC Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\vnc\shell]

[HKEY_CLASSES_ROOT\vnc\shell\open]

[HKEY_CLASSES_ROOT\vnc\shell\open\command]
@="\"C:\\Program Files\\RealVNC\\VNC Viewer\\vncviewer.exe" "%1"

Then. I try to run

enter image description here

But programm run not correct

enter image description here

Instead of addresses, it adds the word vnc. How can I remove this word?


Solution

  • The reason it doesn't work is because VNCViewer doesn't understand "vnc:192.168.4.107" as a valid argument.

    You need to create a custom handler which removes the vnc: and passes the rest of the string to the executable.

    Thankfully, someone already did this on the UltraVNC forums:

    ECHO OFF
    SET S=%1
    SET S=###%S%###
    SET S=%S:"###=%
    SET S=%S:###"=%
    SET S=%S:###=%
    SET S=%S:vnc:=%
    start "VNCViewer" "C:\Program Files\UltraVNC\vncviewer.exe" -connect %S%