o0julia0o
Goto Top

Standardbrowser per Batch ändern?

Wie kann ich den Windows10 Standard-Browser mit einer Batch-Datei ändern?

Content-Key: 6850484695

Url: https://administrator.de/contentid/6850484695

Printed on: April 27, 2024 at 10:04 o'clock

Member: kpunkt
kpunkt Apr 20, 2023 updated at 11:33:50 (UTC)
Goto Top
In der Regel indem du den entsprechenden Browser mit einem Schalter aufrufst.
Chrome hat (oder hatte mal) den Schalter -make-default-browser

Man kann auch mit den Extensions spielen.
assoc
https://learn.microsoft.com/de-de/windows-server/administration/windows- ...

ftype gibts auch noch
https://learn.microsoft.com/de-de/windows-server/administration/windows- ...
Member: colinardo
Solution colinardo Apr 20, 2023, updated at Apr 30, 2023 at 10:12:52 (UTC)
Goto Top
Servus.
Powershell:
<#
    Set machine default browser
#>
param(
    [parameter(mandatory=$true)][ValidateSet('Mozilla Firefox','Microsoft Edge','Google Chrome')][string]$browser  
)
$ErrorActionPreference = 'Stop'  
# run elevated if it's not  
if(!(new-object System.Security.Principal.WindowsPrincipal([System.Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole(544)){start powershell -Verb runas -ArgumentList "-File `"$($MyInvocation.MyCommand.Definition)`" -browser `"$browser`"";exit}  

write-host "Setting Default Browser to '$browser' ..." -F Green -NoNewline  
# available browsers
$browsers = @{
    "Google Chrome" = "ChromeHTML"  
    "Mozilla Firefox" = "FirefoxHTML-308046B0AF4A39CB"  
    "Microsoft Edge" = "MSEdgeHTM"  
}
# xml location
$xml = "C:\ProgramData\defaultbrowser.xml"  
# registry key
$key = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\System'  
# config
@"  
<?xml version="1.0" encoding="UTF-8"?>  
<DefaultAssociations>
  <Association ApplicationName="$browser" ProgId="$($browsers.$browser)" Identifier=".html"/>  
  <Association ApplicationName="$browser" ProgId="$($browsers.$browser)" Identifier=".htm"/>  
  <Association ApplicationName="$browser" ProgId="$($browsers.$browser)" Identifier="http"/>  
  <Association ApplicationName="$browser" ProgId="$($browsers.$browser)" Identifier="https"/>  
</DefaultAssociations>
"@ | set-content $xml  

if (!(Test-Path $key)){New-Item $key -Force}
New-ItemProperty $key -Name DefaultAssociationsConfiguration -Value $xml -Force | out-null
write-host "OK" -F Green  
write-host "Default Browser setting for machine is in affect after logoff/restart." -F Green  
timeout /t 5

Aufruf aus der Powershell dann mittels folgender Zeilen
.\SetMachineDefaultBrowser.ps1 -browser "Google Chrome"  
.\SetMachineDefaultBrowser.ps1 -browser "Mozilla Firefox"  
.\SetMachineDefaultBrowser.ps1 -browser "Microsoft Edge"  

https://learn.microsoft.com/en-us/deployedge/edge-default-browser

Grüße Uwe
Member: Crusher79
Crusher79 Apr 20, 2023 updated at 13:40:04 (UTC)
Goto Top
Zitat von @colinardo:

Servus.
Powershell:

Ja aber aufpassen:

https://github.com/DanysysTeam/PS-SFTA/find/master

SFTA schaft das auch.

.url, IE.AssocFile.URL

Auch wenn Firefox Default ist bleibt .url z.B. so stehen.

In @colinardo Betirag war das ausgeklammert. Nur für den Fall das man selber mal basteln will. Ratsam wäre es dann ggf. auch mit z.B. Get-SFTA alles zu holen und via Systemsteuerung zu setzen. Dann zu vergleichen. face-wink

Kenn ich aus eigener Erfahrung. Ach ja, .url ist ja auch was mit Browsern..... Das macht dann schnell mal Aua.
Member: Dirmhirn
Dirmhirn Apr 20, 2023 at 16:49:30 (UTC)
Goto Top
Hi,

Per GPO/Regkey, ging es auch einmal... aber seit dem 2023-04 CU, wohl nur mehr für MS Edge.

https://learn.microsoft.com/en-us/answers/questions/1225895/2023-04-cumu ..)

Oder ist das eh der Grund, wieso du nach einer Batch Lösung suchst?

Sg Dirm
Member: o0Julia0o
o0Julia0o Apr 20, 2023 at 22:20:06 (UTC)
Goto Top
Danke, nein - dass das nur mit MS Edge geht ist nicht der Grund.

Kann ich nicht auf 2 Firefox portable nutzen und einen davon jeweils zum Standardbrowser machen? Oder müssen es veschiedene Browser sein? Und müssen es Non-Portable Browser sein?