IT tutorials
 
Windows
 

Windows 8 : Understanding File Types - File Types and File Extensions, File Types and the Registry

- How To Install Windows Server 2012 On VirtualBox
- How To Bypass Torrent Connection Blocking By Your ISP
- How To Install Actual Facebook App On Kindle Fire
1/20/2015 3:42:57 AM

File Types and File Extensions

One of the fictions that Microsoft has tried to foist on the computer-using public is that we live in a “document-centric” world. That is, that people care only about the documents they create and not about the applications they use to create those documents. This is actually not all that far from the truth if you only use the new Windows 8 interface because Windows 8 apps are designed to hide their interface elements, so you see only the document (whatever it might be) that’s currently onscreen.

However, for the rest of us who spend the majority of our time in the Desktop app, this notion of a document-focused computing world is pure hokum. The reality is that applications are still too difficult to use and the capability to share documents between applications is still too problematic. In other words, you can’t create documents unless you learn the ins and outs of an application, and you can’t share documents with others unless you use compatible applications.

Unfortunately, we’re stuck with Microsoft’s worship of the document and all the problems that this worship creates. A good example is the hiding of file extensions. Windows 8 turns off file extensions by default, and this creates a whole host of problems, from the confusion of trying to determine a file type based on a teensy icon, to not being able to edit extensions, to not being able to save a file under an extension of your choice. You can overcome all these problems by turning on file extensions, as we show later.

Why does the lack of file extensions cause such a fuss? Because file extensions determine the file type of a document. In other words, if Windows 8 sees that a file has a .txt extension, it concludes the file uses the Text Document file type. Similarly, a file with the extension .bmp uses the Bitmap Image file type.

The file type, in turn, determines the application that’s associated with the extension. If a file has a .txt extension, Windows 8 associates that extension with Notepad, so the file will always open in Notepad. Nothing else inherent in the file determines the file type; therefore, at least from the point of view of the user, the entire Windows 8 file system rests on the scrawny shoulders of the humble file extension.

This method of determining file types is, no doubt, a poor design decision. For example, there is some danger that a novice user could render a file useless by imprudently renaming its extension. Interestingly, Microsoft seems to have recognized this danger and programmed a subtle behavior change into recent versions of Windows (Windows Vista and later): when file extensions are turned on and you activate the Rename command (click the file and then press F2), Windows displays the usual text box around the entire filename, but it selects only the file’s primary name (the part to the left of the dot), as shown in Figure 1. Pressing any character obliterates the primary name, but leaves the extension intact.

Image

Figure 1. When you activate the Rename command with file extensions turned on, Windows selects just the file’s primary name.

Despite the drawbacks that come with file extensions, they lead to some powerful methods for manipulating and controlling the Windows 8 file system.

File Types and the Registry

As you might expect, everything Windows 8 knows about file types is defined in the Registry. Open the Registry Editor (in the Start screen, type regedit, press Enter, and enter your UAC credentials) and examine the HKEY_CLASSES_ROOT key. Notice that it’s divided into two sections:

• The first part of HKEY_CLASSES_ROOT consists of dozens of file extension subkeys (such as .bmp and .txt). There are well over 400 such subkeys in a basic Windows 8 installation, and there could easily be two or three times that number on a system with many applications installed.

• The second part of HKEY_CLASSES_ROOT lists the various file types associated with the registered extensions. When an extension is associated with a particular file type, the extension is said to be registered with Windows 8.


 Note

HKEY_CLASSES_ROOT also stores information on ActiveX controls in its CLSID subkey. Many of these controls also have corresponding subkeys in the second half of HKEY_CLASSES_ROOT.


To see what this all means, take a look at Figure 2. Here, we’ve selected the .txt key, which has txtfile as its Default value.

Image

Figure 2. The first part of the HKEY_CLASSES_ROOT key contains subkeys for all the registered file extensions.

That Default value is a pointer to the extension’s associated file type subkey in the second half of HKEY_CLASSES_ROOT. Figure 3 shows the txtfile subkey associated with the .txt extension. Here are some notes about this file type subkey:

• The Default value is a description of the file type (Text Document, in this case).

• The DefaultIcon subkey defines the icon that’s displayed with any file that uses this type.

• The shell subkey determines the actions that can be performed with this file type. These actions vary depending on the file type, but Open and Print are common. The Open action determines the application that’s associated with the file type. For example, the Open action for a Text Document file type is the following:

%SystemRoot%\system32\NOTEPAD.EXE %1

Image

Figure 3. The second part of HKEY_CLASSES_ROOT contains the file type data associated with each extension.


 Note

The %1 at the end of the command is a placeholder that refers to the document being opened (if any). If you double-click a file named memo.txt, for example, the %1 placeholder is replaced by memo.txt, which tells Windows to run Notepad and open that file.

 
Others
 
- Personalizing Windows 8 : Protecting Yourself with Windows Firewall - Advanced Firewall Configuration
- Personalizing Windows 8 : Protecting Yourself with Windows Firewall - Making Exceptions to Firewall Protection
- Personalizing Windows 8 : Protecting Yourself with Windows Firewall - Introducing Action Center
- Personalizing Windows 8 : Protecting Yourself with Windows Firewall - How Firewalls Work
- Windows Server 2012 : Managing Users and Data with Dynamic Access Control - Automatic File Classification
- Windows Server 2012 : Managing Users and Data with Dynamic Access Control - Auditing
- Windows Server 2012 : Managing Users and Data with Dynamic Access Control - Access Denied Remediation
- Xbox LIVE and Windows 8 (part 3) - Xbox Companion
- Xbox LIVE and Windows 8 (part 2) - Xbox Games
- Xbox LIVE and Windows 8 (part 1) - Xbox LIVE Accounts
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
programming4us programming4us
 
Popular tags
 
Video Tutorail Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8 BlackBerry Android Ipad Iphone iOS