如何从 UWP 应用程序使用命令行参数启动 win32 exe?

How do you implement Launching a win32 exe with command line arguments from an UWP app?

我正在尝试启动从我的 UWP 应用程序获取命令行参数的旧版 win32 软件。

win32 应用程序 (xxx) 本身不支持激活协议和 URI,但我能够通过使用注册表项添加它:

Windows Registry Editor Version 5.00

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

[HKEY_CLASSES_ROOT\xxx\shell]

[HKEY_CLASSES_ROOT\xxx\shell\open]
@=""

[HKEY_CLASSES_ROOT\xxx\shell\open\command]
@="\"C:\Program Files (x86)\xxx\xxx.exe\" \"%1\""

我在我的 UWP 应用程序中实现了以下内容,但它只启动应用程序并且不传递参数:

 await Launcher.LaunchUriAsync(new Uri("xxx:aaa=123"));

如何将命令行参数从 UWP 传递到 Win32 应用程序?

我不介意创建一个 Win32 应用程序或控制台应用程序作为中间人来读取激活协议并将其转换为命令行参数和 运行 win32 但找不到任何这样做的解决方案。

谢谢。

I tried xxx:\aaa=123. However, it passes the argument (%1) as a whole including the protocol. How do I remove or replace the xxx:\ from %1

请检查 @="\"C:\Program Files (x86)\xxx\xxx.exe\" \"%1\"",它默认包含 %1。您可以手动删除它。