前段时间有个程序要求获取系统的默认浏览器,baidu、Google了好久,后又结合procmon.exe跟踪浏览器打开web页面的注册表操作信息,找到了最终的位置,这里做一个总结。亲测win10多个浏览器都OK。而我们需要修改默认浏览器时只要按照这个步骤对应修改就可以了。
1、默认浏览器配置在注册表中的结构介绍
先来讲一下系统中存储这个键值的结构。
1)在注册表的一个特定路径存储了一个名字,比如叫test
2)在注册表的另一个路径中把这个test作为了一个中间的路径,然后在这个路径下的多层子路径的位置存储着具体的默认浏览器的默认浏览器路径以及一个缺省的命令行格式。
下面看个实例。
2、实际操作展示
使用的环境:
操作系统:Win10 20H1
浏览器:Google chrome
1)在HKEY_CURRENT_USERSoftwareMicrosoftWindowsShellAssociationsUrlAssociationshttpUserChoice的ProgId键值为[ChromeHTML]
step2:修改HKEY_CLASSES_ROOTChromeHTMLShellopencommand的值为["C:Program Files (x86)GoogleChromeApplicationchrome.exe" --single-argument %1]
作者:耑新新,发布于 博客园
转载请注明出处,欢迎邮件交流:zhuanxinxin@aliyun.com