Search code examples
windowsgoogle-chromecommand-lineterminalcommand-prompt

How to get chrome version using command prompt in windows


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


Solution

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