2024-04-19 07:09:59 发布
网友
有没有办法从命令行显示msi文件的产品名和版本?或者更好的是,这可以通过python实现吗?在
您可以使用以下方法获取产品版本:
from msilib import * def GetMsiProperty(path ,property): db = OpenDatabase(path, MSIDBOPEN_READONLY) view = db.OpenView ("SELECT Value FROM Property WHERE Property='" + property + "'") view.Execute(None) result = view.Fetch() #print dir(result) return result.GetString(1) msiVersion = GetMsiProperty(r'C:\path\to.msi' ,"ProductVersion")
您的python版本必须高于2.5,以上函数才能正常工作。在
尝试SummaryInformation.GetProperty(PID_TITLE)和SummaryInformation.GetProperty(PID_REVNUMBER)以及位于{a1}的所有其他字段名
SummaryInformation.GetProperty(PID_TITLE)
SummaryInformation.GetProperty(PID_REVNUMBER)
您可以使用以下方法获取产品版本:
您的python版本必须高于2.5,以上函数才能正常工作。在
尝试
SummaryInformation.GetProperty(PID_TITLE)
和SummaryInformation.GetProperty(PID_REVNUMBER)
以及位于{a1}的所有其他字段名相关问题 更多 >
编程相关推荐