Untitled
unknown
plain_text
a year ago
968 B
9
Indexable
# Ensure Chrome is installed
$ChromePath = "C:\Program Files\Google\Chrome\Application\chrome.exe"
if (-not (Test-Path $ChromePath)) {
Write-Host "Chrome is not installed in the expected location."
exit
}
# Set Chrome as default browser
$UserChoice = "HKCU:\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice"
$ProgId = "ChromeHTML"
# Set default for http and https
Set-ItemProperty -Path $UserChoice -Name "ProgId" -Value $ProgId
Set-ItemProperty -Path $UserChoice.Replace("http", "https") -Name "ProgId" -Value $ProgId
# Set file type associations
$FileTypes = @(".htm", ".html", ".shtml", ".xht", ".xhtml")
foreach ($Type in $FileTypes) {
cmd /c ftype $Type=$ChromePath -- "%1"
cmd /c assoc $Type=$Type
}
# Force Windows to acknowledge the change
Stop-Process -Name explorer -Force -ErrorAction SilentlyContinue
Start-Process explorer
Write-Host "Chrome has been set as the default browser."Editor is loading...
Leave a Comment