如何从命令行列出已安装的 MSI? [英] How do I list installed MSI from the command line?

查看:28
本文介绍了如何从命令行列出已安装的 MSI?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们最近将 Windows 软件包从 RPM (cygwin) 切换到 MSI (wix).拥有原生包装是一个非常受欢迎的变化,我们打算坚持下去.但是,MSI 感觉它的功能过于复杂,并且似乎没有提供一些基本功能.但我可能错了.

We recently switched our Windows software packages from RPM (cygwin) to MSI (wix). Having a native packaging is a much welcome change and we intend to stick with it. However, MSI feels overly complicated for what it does and doesn't seem to provide some basic abilities. But I'm probably mistaken.

有没有办法从命令行列出所有已安装的 MSI?

Is there a way to list all installed MSI from the command line ?

推荐答案

Mabybe this 是 MSDN 中的示例 VB 脚本的一个很好的起点:

Mabybe this is a good starting point for you example VB Script from MSDN:

strComputer = "."

Set objWMIService = GetObject("winmgmts:" & _
    "{impersonationLevel=impersonate}!\\" & _
    strComputer & _
    "\root\cimv2")

Set colSoftware = objWMIService.ExecQuery _
    ("SELECT * FROM Win32_Product")   

If colSoftware.Count > 0 Then

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objTextFile = objFSO.CreateTextFile( _
        "c:\SoftwareList.txt", True)

    For Each objSoftware in colSoftware
        objTextFile.WriteLine objSoftware.Caption & vbtab & _
        objSoftware.Version
    Next

    objTextFile.Close

Else
    WScript.Echo "Cannot retrieve software from this computer."

End If

这篇关于如何从命令行列出已安装的 MSI?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆