我正在尝试更改文件关联,以便在另一个浏览器中打开 Excel 单元格中的 URL。根据使用(CMD)ftype
命令与Excel.UriLink.16
,我应该能够使用以下命令从 powershell (通过 cmd)执行此操作:
# 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"
这似乎根本没有效果,并且总是会在默认浏览器中打开该 URL。
什么控制着 Excel 打开 URL 以及如何更改它?
UPDATE: 2022-07-30
关注另一个SOhere https://stackoverflow.com/a/51727990/1147688,声明要检查:
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
不幸的是没有帮助。
我开始更好地理解它是如何工作的,看起来它深深地隐藏在操作系统中。看似未记录的程序protocolhandler.exe
负责处理所有 URI 的打开方式。
除此之外assoc
显示.URL=InternetShortcut
,链接到:
InternetShortcut="C:\WINDOWS\system32\rundll32.exe" "C:\WINDOWS\system32\ieframe.dll",OpenURL %l
.
检查其他人,我们发现:
# (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"
如 MS 文档所示URI https://learn.microsoft.com/en-us/dotnet/api/system.uri?view=net-6.0, uri 方案 https://learn.microsoft.com/en-us/office/client-developer/office-uri-schemes以及有关 Excel 的信息Hyperlinks https://www.automateexcel.com/vba/hyperlinks/,这个程序需要能够处理任何事情......
UPDATE: 2022-07-31
显然可见的用法assoc
and ftype
只是烟与镜用于确定File Type Associations
(FTA)。根据this SU https://superuser.com/a/1345497/116221回答,MS 关联 XML https://learn.microsoft.com/en-us/archive/blogs/windowsinternals/windows-10-how-to-configure-file-associations-for-it-pros安全研究人员博客称,自 Win8 以来,Win10+ 中文件的关联方式已完全改变,阻止用户通过哈希关联来控制文件,以确保用户无法轻易更改它们。
要查询文件关联 XML,可以使用:
# 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] 设置用户FTA http://kolbi.cz/blog/2017/10/25/setuserfta-userchoice-hash-defeated-set-file-type-associations-per-user/- 下载:设置用户FTA.zip http://kolbi.cz/SetUserFTA.zip
-
[2] 设置默认浏览器 http://kolbi.cz/blog/2017/11/10/setdefaultbrowser-set-the-default-browser-per-user-on-windows-10-and-server-2016-build-1607/- 下载:设置默认浏览器.zip http://kolbi.cz/SetDefaultBrowser.zip
重要的:
SetUserFTA
必须运行在users语境,not具有管理或系统权限。有时,时间安排可能很重要——确保它在用户配置文件加载后运行。
运行它:
# 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"
...
您还可以按照以下说明关联便携式浏览器here https://kolbi.cz/blog/2019/01/27/register-a-portable-browser-and-make-it-the-default/.
⛔ 处理 Excel 关联的问题仍然没有进展...