I'm trying to change the file association for opening URL's in Excel cell in another browser. According to the use of (CMD) ftype
command with Excel.UriLink.16
, I should be able to do this from powershell (via cmd) using:
# To change it:
cmd /c 'ftype Excel.UriLink.16=C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe "--single-argument" "%1"'
# The original is:
# cmd /c ftype | findstr /i "excel.uri"
# Excel.UriLink.16=C:\Program Files\Microsoft Office\Root\Office16\protocolhandler.exe "%1"
This seem to have no effect at all, and will always open the URL in the default browser.
What is controlling the Excel opening of URLs and how to change this?
UPDATE: 2022-07-30
Following another SO here, state to check:
HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\*\UserChoice
With:
(Get-ItemProperty HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\*\UserChoice -Name ProgId).ProgID | Where-Object -FilterScript{ $_ -like "*HTM*"}
Output:
FirefoxHTML-308046B0AF4A39CB
FirefoxHTML-308046B0AF4A39CB
MSEdgeHTM
MSEdgeHTM
MSEdgeHTM
Unfortunately not helpful.
I'm starting to understand better how this works,and it looks like this is deeply hidden in the OS. The seemingly undocumented program protocolhandler.exe
is taking care of how all URI's are opened.
In addition the assoc
show that .URL=InternetShortcut
, is linked to:
InternetShortcut="C:\WINDOWS\system32\rundll32.exe" "C:\WINDOWS\system32\ieframe.dll",OpenURL %l
.
Checking others, we find:
# (cmd /c ftype |Select-String protocol |Select-String excel ) -replace ("=","=`t")
Excel.UriLink.16= C:\Program Files\Microsoft Office\Root\Office16\protocolhandler.exe "%1"
ms-excel= C:\Program Files\Microsoft Office\Root\Office16\protocolhandler.exe "%1"
As shown in the MS Documentation on URI
, uri-schemes and info on Excel
Hyperlinks
, this program need to be able to handle anything...
UPDATE: 2022-07-31
Apparently the visible usage of assoc
and ftype
are only smoke & mirrors for determining the File Type Associations
(FTA). According to this SU answer, MS assoc XML and a security researchers blog, the way files are associated in Win10+ have completely changed since Win8, preventing user to take control of this by hashing associations to ensure users can't change them easily.
To query the file association XML, you can use:
# Run as Admin
Dism.exe /online /export-defaultappassociations:.\myCurrentFileAssoc.xml
...
<Association Identifier=".url" ProgId="IE.AssocFile.URL" />
...
# If there are any errors, you can find a LOG file in:
C:\WINDOWS\Logs\DISM\dism.log
The unofficial*
tools exists to query and change these are:
(*
Unofficial because MS doesn't want you to mock around with file associations.)
[1] SetUserFTA - Download: SetUserFTA.zip
[2] SetDefaultBrowser - Download: SetDefaultBrowser.zip
IMPORTANT:
SetUserFTA
must be run in the users context, not with administrative or system privileges. Sometimes the timing can be important a swell – make sure it runs after the profile of the user is loaded.
Running it with:
# SetUserFTA.exe get | Select-String url
.url, IE.AssocFile.URL
http, FirefoxURL-308046B0AF4A39CB
https, FirefoxURL-308046B0AF4A39CB
# To see all installed browsers
# SetDefaultBrowser.exe
...
HKLM Brave
name: Brave
path: "C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe"
...
You can also associate portable browsers by following instructions here.
⛔ Still no progress for dealing with Excel assoc's...