Alexandr
Alexandr

Reputation: 231

WIX Toolset MSI. How to read folder name from registry?

This code gives me the value of the PowerShellVersion key.

 <Property Id="POWERSHELLVERSION">
      <RegistrySearch Id="POWERSHELLVERSION"
                      Type="raw"
                      Root="HKLM"
                      Key="SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine"
                      Name="PowerShellVersion"/>
 </Property>

How can I get the name of the folder? For example, I need to find the name of the PowerShellEngine folder in folder 3 and assign it to Property "POWERSHELLVERSION".

 <Property Id="POWERSHELLVERSION">
      <RegistrySearch Id="POWERSHELLVERSION"
                      Type="raw"
                      Root="HKLM"
                      Key="SOFTWARE\Microsoft\PowerShell\3"
                      Name="PowerShellEngine"/>
 </Property>

Upvotes: 0

Views: 99

Answers (1)

Christopher Painter
Christopher Painter

Reputation: 55571

This would assign the value C:\Windows\System32\WindowsPowerShell\v1.0 to POWERSHELLLOCATION.

 <Property Id="POWERSHELLLOCATION">
      <RegistrySearch Id="POWERSHELLVERSION"
                      Type="raw"
                      Root="HKLM"
                      Key="SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine"
                      Name="ApplicationBase"/>
 </Property>

Upvotes: 1

Related Questions