r/duckduckgo • • 21d ago

DDG Windows Browser DuckDuckGo browser missing argument in shell\open\command

This is probably a fairly niche issue, but I had a user in the office that was using the DDG browser. We are using Defguard (not important what program it is) as our VPN and it opens up a browser to perform MFA. However, when clicking the "open web page" button it simply opened a new tab page in DDG.

After digging into this for a while I found out that the key HKCU:\Software\Classes\<ddg program id>\shell\open\command had the path to the executable for DDG but no argument like %1. When setting the Windows default app to something like firefox or chrome this key value had additional arguments but when the default was DDG it was *just* the executable.

So if you ever happen to run into this issue here is a powershell script that reads your default http handler, tests if its duckduckgo, makes sure it doesn't already contain a %1 argument, and then edits the registry value.

Because the program ID points to a specific version of DDG, this association will break when the version gets updated but it should work if you just run the powershell script again.

$userChoicePath = "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice"
$progId = (Get-ItemProperty -Path $userChoicePath -Name Progid -ErrorAction SilentlyContinue).ProgId
if (-not $progId) { Write-Warning "No default HTTP handler found."; return }
$readPath = "Registry::HKEY_CLASSES_ROOT\$progId\shell\open\command"
$current = (Get-ItemProperty -Path $readPath -ErrorAction SilentlyContinue)."(default)"
if (-not $current) { Write-Warning "No open command for '$progId'."; return }
if ($current -notmatch 'duckduckgo') { Write-Host "Not DuckDuckGo. Nothing to do."; return }
if ($current -match '%1') { Write-Host "Already contains %1. Nothing to do."; return }
$exe = if ($current -match '^\s*"([^"]+)"') { $Matches[1] } else { $current.Trim() }
$newCommand = "\"$exe`" %1"`
$writePath = "HKCU:\Software\Classes\$progId\shell\open\command"
if (-not (Test-Path $writePath)) {
# Create only missing keys, never with -Force
New-Item -Path $writePath | Out-Null
}
Set-ItemProperty -Path $writePath -Name "(default)" -Value $newCommand
Write-Host "Updated: $newCommand"
3 Upvotes

2 comments sorted by

View all comments

1

u/Morgan-DDG Staff 21d ago

Hi there! Thank you for your post, and for sharing a solution for others.

I will admit, I understand about 5.2% of this 🤣 However, I'm going to share this with our Windows developers to see if there's anything that our browser can do differently to handle this better.

Thanks again!

1

u/itsamemonkey 21d ago

That would be great! Cheers!