How to get chrome version using command prompt in windows
Asked Answered
A

7

32

Is it possible to get version installed chrome version using command prompt in windows?

Tried,

 "C:\Program Files\Google\Chrome\Application\chrome.exe" -version
 "C:\Program Files\Google\Chrome\Application\chrome.exe" --version
 "C:\Program Files\Google\Chrome\Application\chrome.exe" -product-version
 "C:\Program Files\Google\Chrome\Application\chrome.exe" --product-version

When i do that, a browser instance is opening. What flag should I be using to get the version.

I am using Windows 7. Google Chrome version is 67.0.3396.87.

Thanks in advance

Atkinson answered 15/6, 2018 at 18:24 Comment(0)
B
26

There's a bug filed about this: https://bugs.chromium.org/p/chromium/issues/detail?id=158372

Original Answer (but see the update below)

What works for me is

wmic datafile where name="C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe" get Version /value

It prints

Version=67.0.3396.99

surrounded by some blank lines.

There are some other suggestions in the bug comments, like querying the registry.

Update

Someone from the Chromium team posted this "totally unsupported" batch file in the bug comment thread:

@ECHO OFF

:: Look for machine-wide Chrome installs (stable, Beta, and Dev).
:: Get the name, running version (if an update is pending relaunch), and
:: installed version of each.
FOR %%A IN (
    {8A69D345-D564-463c-AFF1-A69D9E530F96},
    {8237E44A-0054-442C-B6B6-EA0509993955},
    {401C381F-E0DE-4B85-8BD8-3F3F14FBDA57}) DO (
  reg query HKLM\Software\Google\Update\Clients\%%A /v name /reg:32 2> NUL
  reg query HKLM\Software\Google\Update\Clients\%%A /v opv /reg:32 2> NUL
  reg query HKLM\Software\Google\Update\Clients\%%A /v pv /reg:32 2> NUL
)

:: Look for Chrome installs in the current user's %LOCALAPPDATA% directory
:: (stable, Beta, Dev, and canary).
:: Get the name, running version (if an update is pending relaunch), and
:: installed version of each.
FOR %%A IN (
    {8A69D345-D564-463c-AFF1-A69D9E530F96},
    {8237E44A-0054-442C-B6B6-EA0509993955},
    {401C381F-E0DE-4B85-8BD8-3F3F14FBDA57},
    {4ea16ac7-fd5a-47c3-875b-dbf4a2008c20}) DO (
  reg query HKCU\Software\Google\Update\Clients\%%A /v name /reg:32 2> NUL
  reg query HKCU\Software\Google\Update\Clients\%%A /v opv /reg:32 2> NUL
  reg query HKCU\Software\Google\Update\Clients\%%A /v pv /reg:32 2> NUL
)

That should probably be seen as the right way to go for the time being.

Byran answered 9/8, 2018 at 17:47 Comment(1)
Thank you very much for this horrifying workaround. I hate Chrome.Smasher
S
33

As of today user4851's is still working. I took a look at his linked bug report and the proposed work around did not work for me anymore.

Anways a new hkey is present in my directory which allows you to query the chrome version without being aware of the actual installation location:

reg query "HKEY_CURRENT_USER\Software\Google\Chrome\BLBeacon" /v version
Secco answered 5/4, 2019 at 9:7 Comment(1)
Beware, this will return the correct version after the first run if the installed Chrome only!Farika
B
26

There's a bug filed about this: https://bugs.chromium.org/p/chromium/issues/detail?id=158372

Original Answer (but see the update below)

What works for me is

wmic datafile where name="C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe" get Version /value

It prints

Version=67.0.3396.99

surrounded by some blank lines.

There are some other suggestions in the bug comments, like querying the registry.

Update

Someone from the Chromium team posted this "totally unsupported" batch file in the bug comment thread:

@ECHO OFF

:: Look for machine-wide Chrome installs (stable, Beta, and Dev).
:: Get the name, running version (if an update is pending relaunch), and
:: installed version of each.
FOR %%A IN (
    {8A69D345-D564-463c-AFF1-A69D9E530F96},
    {8237E44A-0054-442C-B6B6-EA0509993955},
    {401C381F-E0DE-4B85-8BD8-3F3F14FBDA57}) DO (
  reg query HKLM\Software\Google\Update\Clients\%%A /v name /reg:32 2> NUL
  reg query HKLM\Software\Google\Update\Clients\%%A /v opv /reg:32 2> NUL
  reg query HKLM\Software\Google\Update\Clients\%%A /v pv /reg:32 2> NUL
)

:: Look for Chrome installs in the current user's %LOCALAPPDATA% directory
:: (stable, Beta, Dev, and canary).
:: Get the name, running version (if an update is pending relaunch), and
:: installed version of each.
FOR %%A IN (
    {8A69D345-D564-463c-AFF1-A69D9E530F96},
    {8237E44A-0054-442C-B6B6-EA0509993955},
    {401C381F-E0DE-4B85-8BD8-3F3F14FBDA57},
    {4ea16ac7-fd5a-47c3-875b-dbf4a2008c20}) DO (
  reg query HKCU\Software\Google\Update\Clients\%%A /v name /reg:32 2> NUL
  reg query HKCU\Software\Google\Update\Clients\%%A /v opv /reg:32 2> NUL
  reg query HKCU\Software\Google\Update\Clients\%%A /v pv /reg:32 2> NUL
)

That should probably be seen as the right way to go for the time being.

Byran answered 9/8, 2018 at 17:47 Comment(1)
Thank you very much for this horrifying workaround. I hate Chrome.Smasher
B
20

I tried Kilian's answer, however in my case, I was running it against a bunch of machines remotely via a service, so I don't think HKEY_CURRENT_USER was valid:

ERROR: The system was unable to find the specified registry key or value.

Assuming you know where the exe is, you can try a different approach and read the version property of the exe file:

# Powershell
# Older versions install to the 32-bit directory
(Get-Item "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe").VersionInfo

# Newer versions use the 64-bit directory
(Get-Item "C:\Program Files\Google\Chrome\Application\chrome.exe").VersionInfo

ProductVersion   FileVersion      FileName
--------------   -----------      --------
76.0.3809.100    76.0.3809.100    C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

To using it in cmd.exe or via any subprocess calls (python, go os/exec, etc.) you can do,

powershell -command "&{(Get-Item 'Absolute\path\to\chrome.exe').VersionInfo.ProductVersion}"
Brachiopod answered 22/8, 2019 at 23:12 Comment(8)
Had to remove (x86) part in my caseOcular
This is IMHO better than the accepted answer, because it's the only one that works for any Chrome or Chromium binary, even if it isn't "the" installed Chrome.Honeyhoneybee
Thanks @YegorAndrosov, newer versions install to the 64-bit program directory. Updated.Brachiopod
Using this approach on Win10, I only get .VersionInfo was unexpected at this time.Chickabiddy
@lenka_cizkova This is a Powershell script, I got the error you mentioned when using it in cmd.exe. powershell -command "&{(Get-Item "Absolute\path\to\chrome.exe").VersionInfo.ProductVersion}" worked for me from cmd promptSiebert
@PhaniRithvij Good point! (This important piece of information is missing in the answer...)Chickabiddy
I had to use single quotes round 'Absolute\path\to\chrome.exe' or else I was rebuffed with Get-Item : a positional parameter cannot be found that accepts argument 'Files\Google\Chrome...Berchtesgaden
@MartinDorey Good catch, the double quotes around the path was pairing with the double quotes around the entire command. Updated.Brachiopod
M
4

Using only commandline utils

dir /B/AD "C:\Program Files (x86)\Google\Chrome\Application\"|findstr /R /C:"^[0-9].*\..*[0-9]$"
78.0.3904.97

List only directories /AD within the Chrome application folder in short form /B.

findstr /R /C:"..." applies the following regex to the list of directories. The regex matches every foldername starting with a digit ^[0-9] and ending with ad digit [0-9]$. Between the first and last digit there are any characters .* allowed but at least one dot should appear \.

Mortise answered 7/11, 2019 at 11:26 Comment(2)
sorry but this method is totally unreliableSuavity
Even this fails: `start chrome chrome://version'Orebro
C
4

I was able to use the rust kitty's solution without having chrome on my path, as:

  • from PowerShell:
(Get-Command C:\Program Files (x86)\Google\Chrome\Application\chrome.exe').Version.ToString()
  • from cmd:
powershell -command "(Get-Command C:\Program Files (x86)\Google\Chrome\Application\chrome.exe').Version.ToString()"
Choice answered 6/11, 2022 at 20:12 Comment(0)
E
3

user1425134's solution worked for me, but if you are allowed to assume that Chrome is part of %PATH% (if you can open Command Prompt and type chrome to start the browser), then it can be greatly simplified.

From Powershell you can type (Get-Command "chrome").Version.ToString()

Or from cmd.exe you can type powershell -c "(Get-Command "chrome").Version.ToString()"

(same for Chromium, just replace the command name)

Emilio answered 6/5, 2022 at 19:5 Comment(0)
P
0

Via Powershell the command is -

Get-WmiObject -Class Win32_Product | ? {$_.name -eq 'Google Chrome'} |select Name,Version
Preadamite answered 6/12, 2022 at 21:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.