什么是文件扩展名?

A file extension, or filename extension, is a suffix at the end of a computer file. It comes after the period, and is usually two-four characters long. If you’ve ever opened a document or viewed a picture, you’ve probably noticed these letters at the end of your file.

文件扩展名或文件扩展名是计算机文件末尾的后缀。 它在句点之后出现,通常为两到四个字符。 如果您打开过文档或查看过图片,则可能在文件末尾注意到了这些字母。

File extensions are used by the operating system to identify what apps are associated with what file types—in other words, what app opens when you double-click the file. For example, a file named “awesome_picture.jpg” has the “jpg” file extension. When you open that file in Windows, for example, the operating system looks for whatever app is associated with JPG files, opens that app, and loads the file.

操作系统使用文件扩展名来标识哪些应用程序与哪些文件类型相关联,换句话说,双击该文件时将打开什么应用程序。 例如,名为“ awesome_picture.jpg”的文件具有“ jpg”文件扩展名。 例如,当您在Windows中打开该文件时,操作系统将查找与JPG文件关联的任何应用程序,然后打开该应用程序并加载该文件。

有哪些类型的扩展名? (What Types Of Extensions Are There?)

There are many different types of file extensions—way too many to list in an article—but here a few examples of common file extensions you might see floating around on your computer:

文件扩展名有很多不同的类型(在文章中列出的方式太多了),但是在这里,您可能会在计算机上看到一些常见文件扩展名的示例:

  • DOC/DOCX:  A Microsoft Word document. DOC was the original extension used for Word documents, but Microsoft changed the format when Word 2007 debuted. Word documents are now based on the XML format, hence the addition of the “X” at the end of the extension.

    DOC / DOCX: Microsoft Word文档。 DOC是用于Word文档的原始扩展名,但是Microsoft在Word 2007首次发布时更改了格式。 Word文档现在基于XML格式,因此在扩展名的末尾添加了“ X”。

  • XLS/XLSX: – A Microsoft Excel spreadsheet.

    XLS / XLSX: – Microsoft Excel电子表格。

  • PNG: Portable Network Graphics, a lossless image file format.

    PNG:可移植网络图形,一种无损的图像文件格式。

  • HTM/HTML: The HyperText Markup Language format for creating web pages online.

    HTM / HTML:用于在线创建网页的超文本标记语言格式。

  • PDF:  The Portable Document Format originated by Adobe, and used to maintain formatting in distributed documents.

    PDF:可移植文档格式,由Adobe发起,用于维护分布式文档中的格式。

  • EXE: An executable format used for programs you can run.

    EXE:一种可执行格式,用于可以运行的程序。

And like we said, this is just a smattering of the file extensions out there. There are literally thousands.

就像我们说的,这只是文件扩展名的一小部分。 实际上有数千个。

It’s also important to be aware that there are file types out there that are inherently risky, and could be dangerous. Typically, these are executable files that can run certain types of code when you try to open them. Play it safe and don’t open files unless they come from a trusted source.

同样重要的是要注意那里存在着固有的危险并且可能是危险的文件类型。 通常,这些是可执行文件,当您尝试打开它们时可以运行某些类型的代码。 安全播放,除非文件来自受信任的来源,否则请勿打开文件。

如果看不到文件扩展名怎么办? (What If I Don’t See File Extensions on My Files?)

By default, Windows shows file extensions. For a while—in Windows 7, 8, and even 10—this was not true, but fortunately, they changed the default settings. We say fortunately because we feel showing file extensions is not only more helpful, but more secure. Without file extensions showing, it can be hard to tell whether that PDF file you’re looking at (for example) is really a PDF file and not some malicious executable file.

默认情况下,Windows显示文件扩展名。 有一段时间(在Windows 7、8甚至10)中,这不是真的,但是幸运的是,他们更改了默认设置。 我们之所以说幸运,是因为我们觉得显示文件扩展名不仅更有用,而且更安全。 如果没有显示文件扩展名,则很难分辨您正在查看的PDF文件(例如)是否真的是PDF文件,而不是某些恶意的可执行文件。

If file extensions are not showing for you in Windows, they’re easy enough to turn back on. In any File Explorer window, just head to View > Options > Change folder and search options. In the Folder Options window, on the View tab, disable the “Hide extensions for known file types” check box.

如果Windows中没有显示文件扩展名,则很容易重新打开。 在任何“文件资源管理器”窗口中,只需转到视图>选项>更改文件夹和搜索选项。 在“文件夹选项”窗口的“视图”选项卡上,禁用“隐藏已知文件类型的扩展名”复选框。

File extensions do not show up in macOS by default. The reason for this is that macOS doesn’t really use extensions the same way that Windows does (and we’ll talk about that more in the next section).

默认情况下,文件扩展名不显示在macOS中。 原因是macOS并没有像Windows那样真正使用扩展(我们将在下一节中讨论更多内容)。

You can make macOS show file extensions, though, and it’s probably not a bad idea to do so. With Finder open, just head to Finder > Preferences > Advanced, and then enable the “Show all filename extensions” check box.

但是,您可以使macOS显示文件扩展名,这样做可能不是一个坏主意。 在Finder打开的情况下,只需转到Finder>首选项>高级,然后启用“显示所有文件扩展名”复选框。

macOS和Linux如何使用文件扩展名? (How Do macOS And Linux Use File Extensions?)

So, we talked about how Windows uses file extensions to know what type of file it’s dealing with, and what app to use when you open the file. Windows knows that a file named readme.txt is a text file because of that TXT file extension, and it knows to open it with your default text editor. Delete that extension, and Windows won’t know what to do with the file anymore.

因此,我们讨论了Windows如何使用文件扩展名来了解它正在处理的文件类型以及打开文件时使用的应用程序。 由于该TXT文件扩展名,Windows知道名为readme.txt的文件是文本文件,并且它知道使用默认的文本编辑器将其打开。 删除该扩展名,Windows将不再知道如何处理该文件。

While macOS and Linux still use file extensions, they don’t rely on them like Windows does. Instead, they use something called MIME types and creator codes to determine what a file is. This information is stored within the header of the file, and both macOS and Linux use that information to determine what type of file they’re dealing with.

尽管macOS和Linux仍使用文件扩展名,但它们不像Windows那样依赖它们。 相反,他们使用称为MIME类型和创建者代码的名称来确定文件是什么。 此信息存储在文件的标头中,macOS和Linux都使用该信息来确定他们正在处理的文件类型。

Since file extensions aren’t really required on macOS or Linux, you could very well have a valid file with no extension, but the OS could still open the file with the right program because of the file information contained in the file header.

由于macOS或Linux上实际上并不需要文件扩展名,因此您很可能拥有一个没有扩展名的有效文件,但是由于文件头中包含文件信息,因此OS仍可以使用正确的程序打开文件。

We won’t dive too much more into this here, but if you’re interested in learning more, check out our guide to why Linux and macOS don’t need file extensions.

我们在这里不会对此进行过多介绍,但是如果您有兴趣了解更多信息,请查看我们的指南,了解为什么Linux和macOS不需要文件扩展名。

如果更改文件扩展名会怎样? (What Happens If I Change A File’s Extension?)

Based on what we just talked about in the previous section, what happens when you change a file’s extension kind of depends on what operating system you’re using.

根据上一节中刚刚讨论的内容,更改文件扩展名类型时会发生什么情况取决于所使用的操作系统。

In Windows, if you delete a file extension, Windows no longer knows what to do with that file. When you try to open the file, Windows will ask you what app you want to use. If you change an extension—say you rename a file from “coolpic.jpg” to “coolpic.txt”—Windows will try to open the file in the app associated with the new extension, and you’ll either get an error message or an opened, but useless, file. In this example, Notepad (or whatever your default text editor is) did open our “coolpic.txt” file, but it’s just a garbled mess of text.

在Windows中,如果删除文件扩展名,Windows将不再知道如何处理该文件。 当您尝试打开文件时,Windows会询问您要使用的应用程序。 如果您更改扩展名(例如,将文件从“ coolpic.jpg”重命名为“ coolpic.txt”),则Windows将尝试在与新扩展名关联的应用程序中打开该文件,您将收到错误消息或已打开但无用的文件。 在此示例中,记事本(或任何默认的文本编辑器)确实打开了我们的“ coolpic.txt”文件,但这只是乱七八糟的文本。

For that reason, Windows warns you whenever you try to change a file’s extension, and you have to confirm the action.

因此,当您尝试更改文件扩展名时,Windows会警告您,并且您必须确认操作。

If you’re using macOS, something similar happens. You still get a warning message if you try to change a file’s extension.

如果您使用的是macOS,则会发生类似的情况。 如果尝试更改文件的扩展名,仍然会收到警告消息。

If you change the extension to something else, macOS will try to open the file in the app associated with the new extension. And, you’ll either get an error message or a garbled file—just like in Windows.

如果将扩展名更改为其他名称,macOS将尝试在与新扩展名关联的应用程序中打开文件。 而且,您将收到错误消息或乱码文件,就像在Windows中一样。

What’s different from Windows is that if you try to delete a file’s extension in macOS (at least in the Finder), macOS just adds the same extension right back, using data from the file’s MIME type.

与Windows的不同之处在于,如果您尝试删除macOS中的文件扩展名(至少在Finder中),则macOS会使用文件的MIME类型中的数据立即添加相同的扩展名。

If you actually want to change a file’s type—say for example, you wanted to change an image from the JPG to PNG format—you’d need to use software that can actually convert the file.

如果您实际上要更改文件的类型(例如,要将图像从JPG更改为PNG格式),则需要使用可以实际转换文件的软件。

如何更改打开文件的程序 (How to Change the Program That Opens a File)

Whenever you install an app that can open a particular file type, that app and the file extension get registered with your operating system. It’s entirely possible to have multiple apps that can open the same type of file. You can fire up an app, and then load any supported file type into it. Or, you can right-click a file to open its context menu and choose an available app there.

每当您安装可打开特定文件类型的应用程序时,该应用程序和文件扩展名都会在您的操作系统中注册。 完全可能有多个可以打开相同类型文件的应用程序。 您可以启动一个应用程序,然后将任何受支持的文件类型加载到该应用程序中。 或者,您可以右键单击文件以打开其上下文菜单,然后在此处选择一个可用的应用程序。

For example, in the image below, you can see that we’ve got a number of image apps on our Windows system that can open the “coolpic.jpg” file we’ve right-clicked.

例如,在下面的图像中,您可以看到我们的Windows系统上有许多图像应用程序可以打开我们右键单击的“ coolpic.jpg”文件。

However, there’s also a default app associated with each extension. It’s the app that opens when you double-click a file, and in Windows it’s also the app that appears at the top of the list you get when you right-click a file (IrfanView in the image above).

但是,每个扩展也有一个默认应用程序。 双击文件时将打开该应用程序,而在Windows中,右键单击文件时,该应用程序也会显示在列表顶部(上图中的IrfanView)。

And you can change that default app. Just head to Settings > Apps > Default Apps > Choose default apps by file type. Scroll through the (very long) list of file types to find the one you want, and then click the currently-associated app on the right to change it. Check out our full guide to setting your default apps in Windows for more information.

您可以更改该默认应用。 只需转到设置>应用>默认应用>按文件类型选择默认应用即可。 滚动浏览(很长)文件类型列表以找到所需的文件类型,然后单击右侧的当前关联的应用程序进行更改。 查看我们的完整指南,了解如何在Windows中设置默认应用程序,以获取更多信息。

And you can do the same thing in macOS. Just select a file of the type you want to change, and then select File > Get Info from the main menu. In the Info window that pops up, head down to the “Open With” section, and then use the dropdown menu to select a new app. Easy enough.

您可以在macOS中执行相同的操作。 只需选择要更改类型的文件,然后从主菜单中选择“文件”>“获取信息”。 在弹出的“信息”窗口中,向下转到“打开方式”部分,然后使用下拉菜单选择一个新应用。 很简单。

Image Credit: CC0 Creative Commons/Pixabay

图片来源: CC0创用CC / Pixabay

翻译自: https://www.howtogeek.com/356448/what-is-a-file-extension/

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/279349.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

[项目总结]在ios中使用soundtouch库实现变声

这篇文章是项目总结了。 做了段时间的项目,过程中也遇到了很多麻烦,但是好在终于都解决了,这里是这里是项目之后凭着记忆总结出来,大家有遇到同样的问题,希望能参考了,但是我记忆可能不太好了,要…

Myeclipse优化配置

2019独角兽企业重金招聘Python工程师标准>>> 作为企业级开发最流行的工具,用Myeclipse开发java web程序无疑是最合适的,java web前端采用jsp来显示,myeclipse默认打开jsp的视图有卡顿的现象,那么如何更改jsp默认的打开…

Google在Android P中隐藏了真棒的按应用自动旋转功能

Historically, when you turn your phone on its side, the screen rotates. To keep this from happening, you can lock the orientation. But with Android P, Google included a way to have to the best of both worlds. 从历史上看,当您将手机侧放时&#xff…

2015年终总结

2019独角兽企业重金招聘Python工程师标准>>> 2015年终总结 用勇气改变可以改变的事情,用胸怀接受不可以改变的事情,然后用智慧分辨两者的不同! 短信平台sms 影像系统fastfile 统一信任中心uts(单点登录) 简历增加 总结…

笔记本本地连接显示电缆拔出_没有安全电缆槽的笔记本电脑如何固定?

笔记本本地连接显示电缆拔出Historically laptops included a slot in the side for attaching security cables–as seen in the photo here–but increasingly more slender laptops like ultrabooks are omitting the lock-slot from their case design. How do you properl…

JMeter中添加dubbo相关插件异常问题解决

从网上下载了一个dubbo的插件,然后放到JMeter的/lib/ext目录下: 然后启动直接异常 发现启动不了,然后下载了一个全新的JMeter3.2将dubbo插件放到同样的目录,启动,没有问题: 那应该不是JMeter本身的问题 通过…

Servlet异常

一、http status 404 解决办法:检查web.xml中的配置文件,发现jsp页面的提交路径action和web.xml中的路径不匹配,将其修改过来。转载于:https://www.cnblogs.com/ltfxy/p/9671256.html

disk genius_如何预约Apple Store商店或Genius Bar

disk geniusMaybe you have a cracked iPhone screen or your MacBook Pro isn’t charging properly. Whatever your issue, there’s an app for that! If you need tech support or repairs for your Apple device, it’s easy to set up a service appointment right from …

LVM逻辑卷创建管理

在虚拟机中再次添加三张硬盘 1、查看添加的硬盘 [rootrhel-02 ~]# fdisk -l 2、添加分区 [rootrhel-02 ~]# fdisk /dev/sdb 查看分区并保存 3、将物理硬盘分区初始化为物理卷,以便LVM使用 如果没安装LVM的话先去安装 [rootrhel-02 ~]# yum install lvm2 安装完成…

小程序如何获得手机号码_获得小型企业电话号码的最佳方法

小程序如何获得手机号码Lots of small businesses use their personal cellphones when making work related phone calls. Some may even be using old landlines for their calling needs. While it makes sense to use your cellphone, and it can be scary to make a chang…

空间数据索引RTree完全解析及Java实现

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/MongChia1993/article/details/69941783第一部分 空间数据的背景介绍 空间数据的建模 基于实体的模型(基于对象)Entity-based models (or object base…

android页面布局 如何让中间的listview填充剩余部分_谷歌驾驶设计—界面设计布局...

本节提供了可在不同屏幕尺寸范围内缩放的屏幕布局的设计指南。此处定义的padding和keyline值用于Components,Media规范、Notification Center规范和Dialer规范中。指南概览(TL:DR):基于适当的屏幕尺寸类别的基本布局使…

ios 禁用滑动手势_如何禁用笔记本电脑上的Windows 8滑动手势?

ios 禁用滑动手势If you’re not a fan of the touchpad-based swipe gestures in Windows 8 there is a way to completely disable them and reclaim your touchpad. 如果您不喜欢Windows 8中基于触摸板的滑动手势,可以使用一种方法来完全禁用它们并收回您的触摸板…

Java快速入门-01-基础篇

Java快速入门-01-基础篇 如果基础不好或者想学的很细,请参看:菜鸟教程-JAVA本笔记适合快速学习,文章后面也会包含一些常见面试问题,记住快捷键操作,一些内容我就不转载了,直接附上链接,嘻嘻开发…

苹果mac闪退_自从Mac有了WPS,从此和双系统说再见!

薛岗13,712本文共计2266个字,预计阅读时长需要6分钟。大部分使用Macbook的用户都有一个痛点,就是编辑好的office文件,在朋友或同事的windows电脑上展示效果与自己的会有差异。除此外,卡顿、闪退、数据丢失等也是Windows版office在…

初学者计算机_初学者极客:如何在计算机上重新安装Windows

初学者计算机Reinstalling Windows is one of the easiest ways to fix software problems on your computer, whether it’s running slow or infected by viruses. You should also reinstall Windows before you get rid of an old PC. 重新安装Windows是修复计算机上软件问…

win7 32位 安装opencv-python后,运行时提示 from .cv2 import *: DLL load failed: 找不到指定的模块 的解决办法...

安装opencv后,运行一个测试程序提示"from .cv2 import *: DLL load failed: 找不到指定的模块"。于是百度一下解决办法,结果试了N多方法后也没能解决这个问题。 最后不得不耐心的下载了dependency walker来查看opencv到底是缺少了哪个dll文件。…

项目中的模块剥离成项目_使用MCEBuddy 2从电视录制中剥离广告

项目中的模块剥离成项目One of the great things about time-shifting your television viewing is that you are able to watch the shows you love at a time that suits you. Just because you have an appointment on Wednesday evening there’s no need to miss out on y…

gmail收件箱标签设置_通过在Gmail中启用实验室功能来启动收件箱

gmail收件箱标签设置We recently looked at how you can make it easier to manage multiple inboxes in Gmail using the Multiple Inboxes Lab feature. This is a non-standard feature and it’s far from being the only one available to you. In fact there are numerou…

【题解】洛谷P1066 [NOIP2006TG] 2^k进制数(复杂高精+组合推导)

洛谷P1066:https://www.luogu.org/problemnew/show/P1066 思路 挺难的一道题 也很复杂 满足题目要求的种数是两类组合数之和 r的最多位数m为 w/k(当w mod k0 时)w/k1(当 w mod k1 时)First: 位数为2~m的种数 即从2k-1中…