如何在远程计算机上运行 ClickOnce 应用程序 (.appref-ms)?
我尝试使用 WMI 在远程计算机上通过 .appref-ms 快捷方式启动 ClickOnce 应用程序,但无法成功。 如果我尝试运行 notepad.exe,下面的代码可以正常工作。
ManagementPath pm = new ManagementPath(@"\\server\root\cimv2:Win32_process");
ManagementClass processClass = new ManagementClass(pm);
//Get an input parameters object for this method
ManagementBaseObject inParams = processClass.GetMethodParameters("Create");
//Fill in input parameter values
inParams["CommandLine"] = @"C:\Documents and Settings\Start Menu\Programs\New\New App.appref-ms";
//Execute the method
ManagementBaseObject outParams = processClass.InvokeMethod("Create", inParams, null);
I am trying to launch a ClickOnce application via an .appref-ms shortcut on a remote machine using WMI, but cannot succeed. The below code works fine if I try to run notepad.exe.
ManagementPath pm = new ManagementPath(@"\\server\root\cimv2:Win32_process");
ManagementClass processClass = new ManagementClass(pm);
//Get an input parameters object for this method
ManagementBaseObject inParams = processClass.GetMethodParameters("Create");
//Fill in input parameter values
inParams["CommandLine"] = @"C:\Documents and Settings\Start Menu\Programs\New\New App.appref-ms";
//Execute the method
ManagementBaseObject outParams = processClass.InvokeMethod("Create", inParams, null);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试通过
rundll32
启动 .appref-ms 快捷方式:或者,您可以使用应用程序部署 URL,而不是依赖快捷方式路径(您可以通过在文本编辑器):
请记住,
Win32_Process.Create
无法远程创建交互式进程。Try launching the .appref-ms shortcut via
rundll32
:Alternatively, instead of relying on the shortcut path, you could use the application deployment URL (you can see it by opening the .appref-ms file in a text editor):
Keep in mind that
Win32_Process.Create
cannot create interactive processes remotely.您遇到的错误是什么。
顺便说一句,您使用的命令行路径似乎有两个问题。
除此之外,如果您提到您遇到的确切错误,那么这将有助于诊断问题。
What is the error that you are getting.
BTW, there seem to be two problems with the commandline path that you are using.
Apart from that, if you mention the exact error you are getting, then it would be helpful to diagnose the problem.