谷歌反复更改 Chrome 的 .exe 文件路径。有时候它会隐藏在 %APPDATA% 文件夹中,在版本 35/36 中他们又把路径改回了 Program Files 文件夹。此外,在不同的 Windows 版本中可能也有区别。
在 Windows 10 中,谷歌浏览器位于哪里?
谷歌反复更改 Chrome 的 .exe 文件路径。有时候它会隐藏在 %APPDATA% 文件夹中,在版本 35/36 中他们又把路径改回了 Program Files 文件夹。此外,在不同的 Windows 版本中可能也有区别。
在 Windows 10 中,谷歌浏览器位于哪里?
此外,还有注册表键和环境变量可供使用。使用编程的通用方法,请参见 此帖子。
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;
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)
然后在屏幕左侧查找命令行。chrome://version
/Applications/Google Chrome.app/Contents/MacOS/Google Chrome
。 - Petercopter我在安装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
这对我有用。
也许它能帮到你。