diff --git a/setupScriptInfo.ps1 b/setupScriptInfo.ps1 index 6e6398b..6f73b67 100644 --- a/setupScriptInfo.ps1 +++ b/setupScriptInfo.ps1 @@ -194,6 +194,29 @@ $urlShortcut = $wshShell.CreateShortcut((Join-Path $env:PUBLIC "Desktop\Framindm $urlShortcut.TargetPath = "https://framindmap.org/" $urlShortcut.Save() +# Set Firefox as the default browser +if (Test-Path "C:\Program Files\Mozilla Firefox\firefox.exe") { + $browserPath = "C:\Program Files\Mozilla Firefox\firefox.exe" + $browserName = "Mozilla Firefox" + $protocolKeys = "HTTP", "HTTPS", "ftp" + + foreach ($key in $protocolKeys) { + $registryPath = "HKLM:\SOFTWARE\Clients\StartMenuInternet\$browserName\shell\$key\command" + Set-ItemProperty -Path $registryPath -Name "" -Value "$browserPath `"%1`"" + } + $htmlRegistryPath = "HKLM:\SOFTWARE\Classes\http\shell\open\command" + Set-ItemProperty -Path $htmlRegistryPath -Name "" -Value "$browserPath `"%1`"" + $urlRegistryPath = "HKLM:\SOFTWARE\Classes\https\shell\open\command" + Set-ItemProperty -Path $urlRegistryPath -Name "" -Value "$browserPath `"%1`"" + $htmlAssocPath = "HKLM:\SOFTWARE\Classes\.html" + Set-ItemProperty -Path $htmlAssocPath -Name "Default" -Value "$browserName" + $urlAssocPath = "HKLM:\SOFTWARE\Classes\.url" + Set-ItemProperty -Path $urlAssocPath -Name "Default" -Value "$browserName" + [System.Diagnostics.Process]::Start("cmd.exe", "/C rundll32.exe iernonce.dll,OpenURL `$http://www.example.com`") + Write-Host "Firefox has been set as the default browser." +} else { + Write-Host "Firefox is not installed in the default path." +} # Update Windows Install-Module -Name PSWindowsUpdate -Force