如何通过powershell运行appref-ms(clickOnce)应用程序

问题描述 投票:0回答:4

我正在尝试创建一个 PS 脚本,该脚本将读取 xml 文件(服务器名称列表),然后在每个服务器上运行单击一次应用程序。就我而言,Power shell 脚本执行将通过任务计划程序进行安排。

现在的问题是:我找不到通过 Power shell 脚本运行单击一次应用程序的方法

有什么想法吗?

powershell clickonce
4个回答
1
投票

我通过通过资源管理器运行应用程序引用文件来运行它,所以一个例子是

$fileLocation="C: emp\program.appref-ms"

explorer.exe $文件位置


1
投票

本文记录了获取运行 ClickOnce 应用程序的文件路径的过程

https://robindotnet.wordpress.com/2010/03/21/how-to-pass-arguments-to-an-offline-clickonce-application/

如果您可以将此 C#/NET 代码转换为 PowerShell,那么它应该可以工作

StringBuilder sb = new StringBuilder();
sb.Append(Environment.GetFolderPath(Environment.SpecialFolder.Programs));
sb.Append("\\Nightbird");                       //ClickOnce Publisher name (eg Nightbird)
sb.Append("\\TestRunningWithArgs.appref-ms ");  //ClickOnce Product name (eg TestRunningWithArgs)
string shortcutPath = sb.ToString();
System.Diagnostics.Process.Start(shortcutPath, argsToPass);

0
投票

您可以通过在 iexplore.exe 上执行启动过程并将其 URL 传递给 ClickOnce 部署来运行 ClickOnce 应用程序。你能在 PowerShell 中做到这一点吗?如果是这样,那么它应该可以工作。


0
投票

试试这个: PowerShell“&启动进程'file://PATH_OF_YOUR.appref-ms'

© www.soinside.com 2019 - 2024. All rights reserved.