简体   繁体   English

如何判断Windows是否显示文件扩展名?

[英]How to determine if Windows shows file extensions?

On Windows the user has an option to display/hide file extensions when viewing files.在 Windows 上,用户可以选择在查看文件时显示/隐藏文件扩展名。 How can I programmatically find the current setting of this option?如何以编程方式找到此选项的当前设置?

You can find the setting in the registry under 您可以在注册表下找到设置

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced

It's named HideFileExt . 它名为HideFileExt

Disclaimer: This is an implementation detail of Explorer and you should by no means rely on the fact that location and name of that setting will remain there or not change in future versions of Windows. 免责声明: 这是Explorer的实现细节,您绝对不应依赖该设置的位置和名称会保留在该位置或在以后的Windows版本中不会更改的事实。 For a start skim over Raymond Chen's blog The Old New Thing to see how many people wrongly assume that Windows software internals are unchanging and available for their (mis)use. 首先浏览一下Raymond Chen的博客 The Old New Thing, 以了解有多少人错误地认为Windows软件的内部结构是不变的并且可供(错误)使用。 At best don't rely on whatever people set their settings to. 充其量不要依赖任何人对其设置进行设置。 It's highly unlikely that this setting will affect any other application than a shell extension. 此设置极不可能会影响除Shell扩展之外的任何其他应用程序。

Please go to Registry Editor to check.请go到注册表编辑器进行检查。 Follow the following path:请遵循以下路径:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced

Now, double click on HideFileExt on the right side.现在,双击右侧的HideFileExt

In Value data:在价值数据中:

  • Enter 0 to display the file extension.输入0以显示文件扩展名。

  • Enter 1 to hide the file extension.输入1隐藏文件扩展名。

Source: Here资料来源: 这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM