Windows 10 中 Google Chrome 的路径

38

谷歌反复更改 Chrome 的 .exe 文件路径。有时候它会隐藏在 %APPDATA% 文件夹中,在版本 35/36 中他们又把路径改回了 Program Files 文件夹。此外,在不同的 Windows 版本中可能也有区别。

在 Windows 10 中,谷歌浏览器位于哪里?


请参见以下链接:https://dev59.com/yqPia4cB1Zd3GeqP497-#45384927 - zumalifeguard
7个回答

53

3
Chrome中的“打开文件位置”功能在我的操作系统中无法使用。 - Dmitry Malugin
5
检查子进程而不是主进程。 - Gregor Sondermeier

30

Windows 10:

  • %ProgramFiles%\Google\Chrome\Application\chrome.exe
  • %ProgramFiles(x86)%\Google\Chrome\Application\chrome.exe
  • %LocalAppData%\Google\Chrome\Application\chrome.exe

Windows 7:

  • C:\Program Files (x86)\Google\Application\chrome.exe

Vista:

  • C:\Users\UserName\AppDataLocal\Google\Chrome

XP:

  • C:\Documents and Settings\UserName\Local Settings\Application Data\Google\Chrome

此外,还有注册表键和环境变量可供使用。使用编程的通用方法,请参见 此帖子


2
它又改变了。在Windows 10上,路径可能是C:\Users\USER\AppData\Local\Google\Chrome\Application\chome.exe。 - Gregor Sondermeier

7

Chrome可以安装在Windows的不同位置,针对特定用户或“所有用户”,在这种情况下,它将被安装在Program Files中。

要编程确定其位置:

批处理文件:

set exe=
FOR /F "tokens=2* skip=2" %%a in ('reg query HKCR\ChromeHTML\shell\open\command /ve') do set exe=%%b
set exe=%exe:"=%
set exe=%exe:~0,-6%

PowerShell:

(gp Registry::HKCR\ChromeHTML\shell\open\command)."(Default)" -match '"(.*?)"' | Out-Null
$exe=$matches[1]

C#:

var exe = System.Text.RegularExpressions.Regex.Match((string)Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(@"ChromeHTML\shell\open\command").GetValue(null),
          @"""(.*?)""",
          System.Text.RegularExpressions.RegexOptions.None)
      .Groups[1].Value;

Python
import winreg
import re
command = winreg.QueryValueEx(winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, "ChromeHTML\\shell\open\\command", 0, winreg.KEY_READ), "")[0]
exe=re.search("\"(.*?)\"", command).group(1)

VBA / VBScript

Set objShell = CreateObject("WScript.Shell")
cmd = objShell.RegRead("HKCR\ChromeHTML\shell\open\command\")
exe = Mid(cmd, 2, 999)
exe = Left(exe, InStr(exe, Chr(34)) - 1)

感谢您提供编程答案 - 不确定为什么您想在Stack Overflow上再要另一个else! :) - mutex
1
尝试了批处理版本,但对我无效,因为我的注册表中有: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --single-argument %1 - Tolga
谢谢!关于Python解决方案。正则表达式路径是否缺少一个“\”: "ChromeHTML\shell\open\command" - undefined

2
我写的答案适用于在Windows上安装的任何软件/应用程序。 Windows 10
  1. 点击“Windows”按钮并搜索应用程序,例如Chrome。 右键单击应用程序名称,然后单击“打开文件位置”。 enter image description here

  2. 您将到达该应用程序快捷方式的位置。再次右键单击应用程序快捷方式,然后单击“打开文件位置”,您将从资源管理器中的顶部URL /路径栏获取路径,或者您可以单击“属性”以获取如图所示的路径。 enter image description here

您将从图像选项卡中获得所需应用程序的路径。 enter image description here

注意:不适用于从Windows商店安装的应用程序。


1
要查找 Google 的位置,请输入以下命令...

chrome://version

然后在屏幕左侧查找命令行

1
谢谢!在 MacOS 上(对我来说),它是 /Applications/Google Chrome.app/Contents/MacOS/Google Chrome - Petercopter

0

我在安装Chrome Canary时,在注册表中发现了一些东西。

在批处理文件中,使用chrome.exe总是打开Canary...

然后我从: Equipo\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe "C:\Users\heratess\AppData\Local\Google\Chrome SxS\Application\chrome.exe" 改为: Equipo\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe C:\Program Files\Google\Chrome\Application\chrome.exe

这对我有用。

也许它能帮到你。


0

右键单击子进程以查看打开文件位置:

屏幕截图


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接