VBScript从MSI数据库解析要安装的文件的完整路径

VBScript从MSI数据库解析要安装的文件的完整路径,vbscript,installation,windows-installer,Vbscript,Installation,Windows Installer,我正在尝试使用从外部调用的VBScript从MSI表中查找文件的安装位置 我无法找到使用该vbscript从MSI表解析文件位置的完整路径的方法 我已经尝试并测试了VBscript中的“ComponentPath”。如果该文件在组件中设置为keypath,并且安装了包含该组件的MSI,则这将解析为该文件的完整路径 但如果将相同组件的注册表设置为键路径,则无法显示文件的路径。在这种情况下,路径解析为注册表配置单元,而不是文件位置(例如:注册表配置单元被设置为USERPROFILE组件的keypat

我正在尝试使用从外部调用的VBScript从MSI表中查找文件的安装位置

我无法找到使用该vbscript从MSI表解析文件位置的完整路径的方法

我已经尝试并测试了VBscript中的“ComponentPath”。如果该文件在组件中设置为keypath,并且安装了包含该组件的MSI,则这将解析为该文件的完整路径

但如果将相同组件的注册表设置为键路径,则无法显示文件的路径。在这种情况下,路径解析为注册表配置单元,而不是文件位置(例如:注册表配置单元被设置为USERPROFILE组件的keypath,而输出shon是设置为keypath的注册表)

是否有函数或类在VBScript中实现相同的功能。我可能看得不对,或者在将查询放在这里之前,我似乎用尽了所有可用的选项

下面是代码的这一特定部分。需要一个带有HKCU注册表和APPDATA文件的空白MSI

    Set View_Component = Database.OpenView("SELECT * from `Component`")
    View_Component.Execute  
    Set rec_Component   = View_Component.Fetch

        Set View_Registry = Database.OpenView("SELECT * from `Registry`")
    Do While (rec_Component Is Nothing) = False
        ComponentGUID=rec_Component.StringData(2)
        ComponentPath = objInstaller.ComponentPath(FnMSIFetch("ProductCode"),ComponentGUID)
        If (InStr(1, LCase(ComponentPath),"\appdata\")<>0 Or InStr(1, LCase(ComponentPath),"\application data\")<>0) Then
            'MsgBox("Appdata File Possibly Found in "& rec_Component.StringData(1) & " Component)
            Flag_AppdataFileIsFound = True
            View_Registry.Execute
            Set rec_Registry = View_Registry.Fetch
            '*The below line checks if the REGISTRY table is empty or not.
            Do While (rec_Registry Is Nothing) = False
                '*The below line checks if the same component has an entry in registry table, and if that registry is an HKCU one.
                If rec_Component.StringData(1) = rec_Registry.StringData(6) And rec_Registry.StringData(2) = "1" Then
                'MsgBox("HKCU also present in APPDATA Component")
                    Flag_AppDataCompHasRegistryKey = True
                    If rec_Component.StringData(6) = rec_Registry.StringData(1) Then
                        'MsgBox("HKCU is set as keypath for APPDATA Component")
                        Flag_HKCUIsKeyPathForAppdataFile = True
                        Exit Do
                    Else
                        Flag_HKCUIsNotKeyPathForAppdataFile = True
                    End If
                Else
                    Flag_AppDataCompDoesNotHaveRegistryKey = True
                    'MsgBox("HKCU is not present in APPDATA Component - " & rec_Component.StringData(1))

                End If
                Set rec_Registry = View_Registry.Fetch
            Loop
        Else
        Flag_AppdataFileIsNotFound = True
        End If
        Set rec_Component   = View_Component.Fetch
    Loop
Set View\u Component=Database.OpenView(“从'Component`中选择*”)
查看组件。执行
设置rec\u Component=View\u Component.Fetch
设置View\u Registry=Database.OpenView(“从注册表中选择*”)
Do While(rec_组件为Nothing)=False
ComponentGUID=rec_Component.StringData(2)
ComponentPath=objInstaller.ComponentPath(FNMISFETCH(“产品代码”),ComponentGUID)
如果(InStr(1,LCase(ComponentPath),“\appdata\”)0或InStr(1,LCase(ComponentPath),“\application data\”)0),则
'MsgBox(“Appdata文件可能位于”&rec_Component.StringData(1)和“Component”中)
Flag_AppdataFileIsFound=True
View\u Registry.Execute
设置rec\u Registry=View\u Registry.Fetch
“*下一行检查注册表表是否为空。
Do While(rec_注册表为Nothing)=False
“*下一行检查同一组件在注册表表中是否有条目,以及该注册表是否为HKCU注册表。
如果rec_Component.StringData(1)=rec_Registry.StringData(6)和rec_Registry.StringData(2)=“1”,则
'MsgBox(“香港大学也存在于APPDATA组件中”)
Flag_AppDataCompHasRegistryKey=True
如果rec_Component.StringData(6)=rec_Registry.StringData(1),则
'MsgBox(“HKCU设置为APPDATA组件的密钥路径”)
Flag_HKCUISKEYPATHFORAPPDATA文件=真
退出Do
其他的
Flag_HKCUIsNotKeyPathForAppdataFile=True
如果结束
其他的
Flag_appdatacompdoethaveregistrykey=True
'MsgBox(“APPDATA组件-”和rec_组件.StringData(1)中不存在HKCU”)
如果结束
设置rec\u Registry=View\u Registry.Fetch
环
其他的
Flag_AppdataFileIsNotFound=True
如果结束
设置rec\u Component=View\u Component.Fetch
环

请显示您的代码。我已经添加了代码。非常感谢您的帮助