从命令行获取Windows 10中文件类型关联的最佳方法? [英] Best way to get file type association in Windows 10 from command line?

查看:37
本文介绍了从命令行获取Windows 10中文件类型关联的最佳方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以在命令行上使用assoc和ftype来获取文件类型关联.所以当我这样做时:

I am aware that I can use assoc and ftype on the command line to get the file type assocation. So when i do:

给人以.explorer.html文件打开的印象.

I am under the impression that .html files are opened with iexplorer.

由于chrome已被设置为html文件的默认应用程序,因此html文件会以chrome打开.

However html files are opening with chrome since chrome has been set as the default app for html files.

当确实使用chrome打开程序时,为什么ftype给我iexplorer?

Why is ftype giving me iexplorer when indeed the program opens with chrome?

推荐答案

在运行Windows 8或更高版本的系统上,ftype和assoc似乎毫无用处.

It seems that ftype and assoc are pretty useless on systems running Windows 8 or later.

这是由于Microsoft在Windows 8中决定用户只能通过内置GUI来设置默认程序的事实.这可能是由于安全原因以及应用程序劫持文件类型关联的麻烦.

This is due to the fact that Microsoft decided in Windows 8 that users should be able to set default programs only via the built in GUI. This probably was due to security reasons and trouble with applications hijacking file type associations.

因此引入了新的注册表项,并且Windows现在将用户选择写入

Therefore a new registry key was introduced and Windows now writes the user choice to

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\<extension>\UserChoice

密钥包含Prog-Id和哈希值.正确的哈希值证明UserChoice ProgId值是由用户设置的,而不是由其他任何应用程序设置的.如果哈希无效,则Windows会将用户选择重置为默认应用程序.

The key contains a Prog-Id and a Hash Value. The correct Hash value proves that the UserChoice ProgId value was set by the user, and not by any other application. If the hash is invalid, windows will reset the user choice to the default application.

ftype命令但是不知道上面的注册表项.

The ftype command however is not aware of the above registry key.

它读取 HKCR \ htmlfile \ shell \ open \ command \(默认)注册表项并打印出结果.

It reads the HKCR\htmlfile\shell\open\command\(Default) registry key and prints out the result.

因此,因此无法使用ftype命令的结果来确定哪个应用程序与特定文件扩展名相关联.

Therefore the results of the ftype command therefore are not usuable to determine which application is associated with a specific file extension.

这篇关于从命令行获取Windows 10中文件类型关联的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆