使用 VBScript 启动 ClickOnce 部署的 Windows 应用程序
我有一个 ClickOnce 部署的应用程序,我想从 VBScript 启动,类似于在以下示例中启动 Microsoft Word:
Dim word
Set word = CreateObject("Word.Application")
word.Visible = True
问题是我不知道将什么参数传递到 CreateObject
函数来启动我的应用程序。 我在哪里可以找到我的电脑上安装的应用程序的主列表/调用以启动它们的快捷方式?
I have a ClickOnce deployed application I want to launch from VBScript, similar to launching Microsoft Word in the following example:
Dim word
Set word = CreateObject("Word.Application")
word.Visible = True
The problem is I don't know what parameter to pass into the CreateObject
function to launch my application. Where would I find the master list of applications installed on my PC/the shortcut to call to launch them?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
ClickOnce 根本就不是这样安装的。 它们通常没有 COM 挂钩(用于 CreateObject),并且安装在用户配置文件(不是该计算机的配置文件)的隔离部分中。 并且不要忘记,您还可以通过 ClickOnce(从不同位置)一次获取同一应用程序的多个副本/版本。
一种选择(在 3.5/VS2008 中)可能是使用新的文件关联内容...将您的应用程序与“.foo”文件关联,创建一个空的“.foo”文件并启动它。 这可能有用。 查看 VS2008 中的 Publish=>Options 对话框。
否则 - 基本上,如果您想要这种类型的使用,我怀疑您将需要使用 msi(即常规安装程序;而不是 ClickOnce)将您的应用程序注册为 COM 库 (dll)。 请注意,.NET 不能构成良好的 COM 服务器 (exe) - 因此不能直接与 Word 进行比较。 如果您想要一个 .NET COM 服务器,那么“服务组件”是您最好的选择 - 但这些组件在 UI 上往往并不重要。
有关信息,隔离区域位于“%userprofile%\Local Settings\Apps\2.0”附近,但这只是出于兴趣,以便您可以看到它..不要尝试从那里运行它。
ClickOnce simply isn't installed that way. They don't typically have COM hooks (for CreateObject), and are installed in an isolated part of the user's profile (not that machine's profile). And don't forget you can also get multiple copies/versions of the same app at once via ClickOnce (from different locations).
One option (in 3.5/VS2008) might be to use the new file associations stuff... associate your app with ".foo" files, create an empty ".foo" file and start it. That might work. Look on the Publish=>Options dialog in VS2008.
Otherwise - basically, if you want this type of usage, I suspect you will need to use msi (i.e. a regular installer; not ClickOnce) to register your app as a COM library (dll). Note that .NET doesn't make a good COM server (exe) - so doesn't compare directly to Word. If you want a .NET COM server, then "serviced components" are your best bet - but these don't tend to be big on UI.
For info, the isolated area is somewhere around "%userprofile%\Local Settings\Apps\2.0", but this is just for interest so you can see it.. don't try running it from there.
谢谢(你的)信息。 这让我意识到我可以使用 .Net 可执行文件而不是 vbscript 来启动我的应用程序。
Thanks for the info. That made me realize that I could use a .Net executable instead of a vbscript to launch my application.