Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get info about MSI file - Write version in an environment variable #5

Open
bovirus opened this issue Dec 6, 2024 · 3 comments
Open

Comments

@bovirus
Copy link

bovirus commented Dec 6, 2024

@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.

@bastienperez
Copy link
Contributor

Hello,

You can use:
$version = (Get-MSIFileInformation -FilePath "pathToYourMSI.msi").ProductVersion

Or did I misunderstand your request?

@bovirus
Copy link
Author

bovirus commented Dec 6, 2024

@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.

@bastienperez
Copy link
Contributor

bastienperez commented Dec 6, 2024

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 {}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants