Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PowerShell: Firefox version check using Powershell

Trying to uninstall firefox using a powershell bat script. But i need to know which Firefox version is currently running and what is the folder name under program files/! I go lots of long script like: https://p0w3rsh3ll.wordpress.com/2012/02/19/get-firefoxinfo/

but i just want something simple which just return the current firefox version.

like image 379
M.M.H.Masud Avatar asked Dec 01 '25 06:12

M.M.H.Masud


2 Answers

Firefox specifically contains a command-line option to get the version, as well as instructions on how to use it on Windows. This one-liner will get your current Firefox version (presuming you're in the right folder or your Firefox is in the system path):

$ffversion = [string](.\firefox.exe -v| Write-Output)

The | Write-Output bit is crucial, for now, due to a documented bug. The result is then converted to a string (also necessary) and saved as a variable here.

$firefox = (Get-Item (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe').'(Default)').VersionInfo
like image 27
Mike Avatar answered Dec 03 '25 22:12

Mike



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!