sql - 列出 msi 文件中的表?
解决方案
MSI SDK: _Tables 表是一个只读系统表,列出了数据库中的所有表。查询此表以查明表是否存在。
改编来自Windows Installer SDKWiExport.vbs
的Windows Installer 脚本示例中的脚本,您会得到如下所示的内容。
MSI SDK VBScripts:为了找到
WiExport.vbs
:安装了 Visual Studio,请查看:(%ProgramFiles(x86)%\Windows Kits\10\bin\10.0.17763.0\x86
调整当前安装的版本号)(或仅在 github.com 上搜索)。
示例屏幕截图:这是以下脚本的示例运行:
示例:脚本程序:
1)
另存为ListMSITables.vbs
桌面(链接到 github.com)2)
将 MSI 文件拖放到 VBScript 上3)
一个消息框将显示表格的数量和表格名称
注意:非常大的 MSI 文件可能会使消息框溢出屏幕。只需按任意键即可关闭(我使用ESC
)。
On Error Resume Next
Const msiOpenDatabaseModeReadOnly = 0
Dim installer : Set installer = Nothing
Set installer = Wscript.CreateObject("WindowsInstaller.Installer")
Dim counter : counter = 0
' Verify incoming drag and drop arguments
If WScript.Arguments.Count = 0 Then MsgBox "Drag and drop an MSI file onto the VBScript" End If
filename = Wscript.Arguments(0)
If (Right (LCase(filename),3) <> "msi") Then
WScript.Quit
End If
Dim database : Set database = installer.OpenDatabase(filename, msiOpenDatabaseModeReadOnly)
Dim table, view, record
Set view = database.OpenView("SELECT `Name` FROM _Tables")
view.Execute
Do
Set record = view.Fetch
If record Is Nothing Then Exit Do
table = record.StringData(1)
tables = tables + table + vbNewLine
counter = counter + 1
Loop
MsgBox "Number of tables: " + CStr(counter) + vbNewLine + vbNewLine + tables
Set view = Nothing
Github.com:上面显然是 VBScript。只需掠夺 github.com以获取更多相同的内容,包括各种语言。
链接:
推荐阅读
- bpel - 是否有任何工具或代码可以将 BPEL 转换为 NuSMV 代码?
- android - java.lang.IllegalStateException:无法压缩回收的位图
- php - universal navbar and sidebar HTML
- c - 理解“volatile”关键字和比较的工作原理
- regex - 正则表达式不完全匹配所需的模式
- azure-devops - 构建 AzureRM 客户端时出错:从 Azure CLI 填充客户端 ID 时出错:未找到授权令牌
- java - 如何在android中使用两个Web服务?
- machine-learning - 逻辑回归:多分类的一对多方法
- reactjs - 如何通过在线开发来开发 React 应用程序
- qt - QML:平面不可滚动列表视图