有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java在注册表编辑器中为MikroTik Winbox添加自定义协议

我有一个名为Winbox的小型windows应用程序(它是一个控制Routboard的小型应用程序)。 我们正在制作一个web应用程序,需要制作一个自定义协议URL,如:

oxo://192.168.103.3 {USERNAME} {PASSWORD}

我只需要将oxo://指向[c:/winbox.exe],并使用参数{IP地址}{USERNAME}{PASSWORD}执行应用程序

所以我编辑了注册表编辑器代码:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\oxo]
@="\"URL:oxo Protocol\""
"EditFlags"=hex:02,00,00,00
"URL Protocol"=""

[HKEY_CLASSES_ROOT\oxo\DefaultIcon]
@="\"C:\\winbox.exe\",0"

[HKEY_CLASSES_ROOT\oxo\shell]

[HKEY_CLASSES_ROOT\oxo\shell\open]

[HKEY_CLASSES_ROOT\oxo\shell\open\command]
@="\"C:\\winbox.exe\" \"%1\""

但问题是,当在浏览器中打开url时,它会在{IP地址}字段中显示“oxo://{IP地址}”。 这是行不通的

我只需要从最终的可执行路径中删除协议名“oxo://”的第一部分

如果你想下载Winbox。exe: http://download2.mikrotik.com/winbox.exe

用法:

winbox.exe {IP ADDRESS} {USERNAME} {PASSWORD}

{IP ADDRESS} : Is the IP Address of the remote RouterBaord device.
{USERNAME} : Is the username of the RouterBoard Device.
{PASSWORD} : Is the password of the RouterBoard Device.
我需要任何帮助来解决这个问题,即使它在爪哇、C、C++或任何编程语言中。p>

我只想运行带有web浏览器参数的exe文件

非常感谢, 阿雷布


共 (1) 个答案

  1. # 1 楼答案

    你的链接包含动态参数, oxo的关键是打开控制台应用程序 您可以将此代码用于控制台应用程序,将应用程序重定向到winbox。exe

     Sub Main()
            On Error Resume Next
            Dim url As String = Command()
            url = url.Replace("/", "")
            url = url.Replace("oxo", "")
            url = url.Replace(":", "")
            Dim arg() As String = url.Split(",")
            Dim IP As String = arg(2)
            Dim Username As String = arg(1)
            Dim Password As String = arg(0)
            Shell("c:\winbox\winbox.exe " & IP & " " & Username & " " & Password)
            Console.WriteLine("Yout username : " & Username & " Password : " & Password & " Ip : " & IP)
        End Sub
    

    你的链接会是

    oxo://{PASSWORD},{USERNAME},{IP}