什么是文件擴展名?

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.pswp.cn/news/279349.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/279349.shtml
英文地址,請注明出處:http://en.pswp.cn/news/279349.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

變量與常量

什么是變量/常量? 變量是計算機內存中的一塊區域,變量可以存儲規定范圍內的值,而且值可以改變。基于變量的數據類型,解釋器會分配指定內存,并決定什么數據可以被存儲在內存中。常量是一塊只讀的內存區域,常…

python藍牙編程_藍牙編程經典程序!

文檔從網絡中收集,已重新整理排版.word版本可編輯.歡迎下載支持.1word版本可編輯.歡迎下載支持.L2CAP socketsExample 4-4. l2cap-server.c#include #include #include #include #include int main(int argc, char **argv){struct sockaddr_l2 loc_addr { 0 }, rem…

[項目總結]在ios中使用soundtouch庫實現變聲

這篇文章是項目總結了。 做了段時間的項目,過程中也遇到了很多麻煩,但是好在終于都解決了,這里是這里是項目之后憑著記憶總結出來,大家有遇到同樣的問題,希望能參考了,但是我記憶可能不太好了,要…

Myeclipse優化配置

2019獨角獸企業重金招聘Python工程師標準>>> 作為企業級開發最流行的工具,用Myeclipse開發java web程序無疑是最合適的,java web前端采用jsp來顯示,myeclipse默認打開jsp的視圖有卡頓的現象,那么如何更改jsp默認的打開…

Java多線程之靜態代理

1 package org.study2.javabase.ThreadsDemo.staticproxy;2 3 /**4 * Date:2018-09-18 靜態代理 設計模式5 * 1、真實角色6 * 2、代理角色:持有真實角色的引用7 * 3、二者實現相同的接口8 * 舉例說明:Couple類和Company類都實現了Marry,…

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…

python 位置參數、默認參數、可變參數位置關系_python的位置參數、默認參數、關鍵字參數、可變參數區別...

一、位置參數調用函數時根據函數定義的參數位置來傳遞參數#!/usr/bin/env python#codingutf-8defprint_hello(name, sex):sex_dict {1: u先生, 2: u女士}print hello %s %s, welcome to python world! %(name, sex_dict.get(sex, u先生))#兩個參數的順序必須一一對應&#xff0…

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本身的問題 通過…

向量空間余弦相似度

設向量a和向量b 則a?b|a||b|cos,|a|和|b|分別為兩向量的模 cos即為兩向量的余弦值,所以cosa?b/|a||b| 距離和相似性度量: http://blog.sina.com.cn/s/blog_6045a9da01011nk7.html 轉載于:https://www.cnblogs.com/lsai/p/3715948.html

linux提升文件夾權限命令_Linux常用命令_(文件權限)

Linux權限管理:二、權限管理1、3種基本權限在Linux中,將使用系統資源的人員分為4類:超級用戶、文件或目錄的屬主、屬主的同組人和其他人員。超級用戶擁有對Linux系統一切操作權限,對 于其他3類用戶都要指定對文件和目錄的訪問權限…

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 …

[置頂] C#中通過調用webService獲取上網IP地址的區域的方法

最近在開發項目的過程中需要獲取用戶查詢時的IP地址的區域,以用來做統計分析用。經過一番查閱資料,然后寫了個測試程序,很快就搞定了這個功能。 現在分享下我的實現方法,大家如果有更好的實現,歡迎提出哦。 首先我找到…

hashmap 存取原理圖_HashMap底層實現原理

HashMap底層原理總結,幾個Hash集合之間的對比。HashMap底層存儲結構HashMap是一個用于存儲Key-Value鍵值對的集合,每一個鍵值對也叫做一個Entry。這些Entry分散存儲在一個數組當中,這個數組就是HashMap的主干。1234567* The table, initializ…

LVM邏輯卷創建管理

在虛擬機中再次添加三張硬盤 1、查看添加的硬盤 [rootrhel-02 ~]# fdisk -l 2、添加分區 [rootrhel-02 ~]# fdisk /dev/sdb 查看分區并保存 3、將物理硬盤分區初始化為物理卷,以便LVM使用 如果沒安裝LVM的話先去安裝 [rootrhel-02 ~]# yum install lvm2 安裝完成…

Start DWM manually on Windows 7 and vista

方法一: 1. 檢查兩處注冊表項及鍵值是否與下列數值一致 HKEY-Current-User\Software\Microsoft\Windows\DWM\Composition 鍵值改為 1 HKEY-Current-User\Software\Microsoft\Windows\DWM\CompositionPolicy 鍵值改為2 2. 打開運行(可能要用到管理員模式啟…

java啟動mysq服務_Java Web開發——MySQL數據庫的安裝與配置

MySQL是一個關系型數據庫管理系統,由瑞典MySQL AB 公司開發,目前屬于 Oracle 旗下產品。MySQL 是最流行的關系型數據庫管理系統之一,在 WEB 應用方面,MySQL是最好的 RDBMS (Relational Database Management System,關系…

小程序如何獲得手機號碼_獲得小型企業電話號碼的最佳方法

小程序如何獲得手機號碼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…