Getestet in Windows 7 x64: Dies ist ein zweistufiger Prozess. Die Standard-Browser des Benutzers ist in Schlüssel:
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.html\UserChoice\Progid
Gemeinsame Browser Schlüsselname:
- IE: IE.AssocFile.HTM
- FireFox: FirefoxHTML
- Chrome: ChromeHTML
- Opera: Opera.HTML
Ersetzen <KEY NAME>
unten mit einem der oben genannten Werte die ausführbare Datei zu finden:
HKCR\<KEY NAME>\shell\open\command
Autohotkey Skript den Standardbrowser Pfad und ausführbare anzuzeigen:
MsgBox % "Default browser: " Browser()
Browser()
{
; Find the Registry key name for the default browser
RegRead, BrowserKeyName, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.html\UserChoice, Progid
; Find the executable command associated with the above Registry key
RegRead, BrowserFullCommand, HKEY_CLASSES_ROOT, %BrowserKeyName%\shell\open\command
; The above RegRead will return the path and executable name of the brower contained within qoutes and optional parameters
; We only want the text contained inside the first set of quotes which is the path and executable
; Find the ending quote position (we know the beginning quote is in position 0 so start searching at position 1)
StringGetPos, pos, BrowserFullCommand, ",,1
; Decrement by one for the StringMid to work correctly
pos := --pos
; Extract and return the path and executable of the browser
StringMid, BrowserPathandEXE, BrowserFullCommand, 2, %pos%
Return BrowserPathandEXE
}
Dank. Es scheint, dass ich die falsche Frage gestellt habe. Wenn Sie auf eine HTML-Datei klicken, wird der Browser geöffnet, der das HTTP-Protokoll registriert hat, nicht der Browser, der sich im Startmenü befindet. Das hat mein Problem gelöst. – soupagain
@soupagain: Eigentlich nein. Wenn Sie auf eine .html ** - Datei ** klicken, ist der Browser, der sie öffnet, derjenige, der die Erweiterung .html registriert hat. Wenn Sie einen http: // ** - Link ** öffnen (z. B. indem Sie ihn in das Feld "Start -> Ausführen" eingeben), öffnet sich der Browser, der das HTTP-Protokoll registriert hat (obwohl es normalerweise derselbe Browser ist) beide Fälle). Sie haben Recht, dass alles, was im Startmenü angezeigt wird, nicht damit zusammenhängt. – Piskvor
Ja, das wollte ich sagen, aber du hast es besser erklärt. – soupagain