是否可以在windows中使用命令提示符获取安装的chrome版本?
试过了,
"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
当我这样做时,会打开一个浏览器实例。我应该用什么标志来获得版本。
我使用的是Windows 7,谷歌Chrome版本是67.0.3396.87。
提前感谢
发布于 2018-08-09 17:47:21
关于这件事有一个错误:https://bugs.chromium.org/p/chromium/issues/detail?id=158372
原始答案(但请参阅下面的更新)
对我有用的是
wmic datafile where name="C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe" get Version /value
印出来
Version=67.0.3396.99
周围环绕着一些空白行。
bug注释中还有其他一些建议,比如查询注册表。
更新
Chromium的某个人在bug评论线程中发布了这个“完全不受支持”的批处理文件:
@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
)
就目前而言,这很可能是正确的选择。
发布于 2019-04-05 09:07:14
到今天为止,用户4851还在工作。我看了一下他的链接错误报告,建议的工作不再适用于我了。
而且,我的目录中有一个新的hkey,它允许您在不知道实际安装位置的情况下查询铬版本:
reg query "HKEY_CURRENT_USER\Software\Google\Chrome\BLBeacon" /v version
发布于 2019-08-22 23:12:08
我尝试了基利安的答案,但是在我的例子中,我通过一个服务对一堆机器运行它,所以我不认为HKEY_CURRENT_USER是有效的:
ERROR: The system was unable to find the specified registry key or value.
假设您知道exe在哪里,您可以尝试另一种方法并读取exe文件的version属性:
# 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
在cmd.exe中或通过任何子进程调用(python、go /exec等)使用它。你可以做的
powershell -command "&{(Get-Item 'Absolute\path\to\chrome.exe').VersionInfo.ProductVersion}"
https://stackoverflow.com/questions/50880917
复制相似问题