Get info about MSI file - Write version in an environment variable
@bastienperez
Thanks for your scripts.
Could be possible to create a .ps1 script thet get version info by .msi file and save the version numebr info in a variable to use this info in a batch file?
Thanks.
Hello,
You can use:
$version = (Get-MSIFileInformation -FilePath "pathToYourMSI.msi").ProductVersion
Or did I misunderstand your request?
@bastienperez
I'd like to run a dos bacyh like
powershell -c "powershellcommands"
and get the MSI version as DOS variable or as text file.
The scope is use in a bach file to analyze the msi file, get version, and set the file name using version.
You can use
powershell -Command "& { . path\To\Get-MSIFileInformation.ps1; (Get-MsiFileInformation -FilePath 'pathToYourMSI.msi').ProductVersion }"
This command will load and run the function within the brackets {}.