Home > Articles > Operating Systems, Server

Mastering File Types in Windows XP

Paul McFedries
  • PrintPrint
  • Share ThisShare This
  • DiscussDiscuss
Close WindowPaul McFedries

Paul McFedries

Learn more…

How Paul McFedries Gets Under the Hood of Microsoft Products
Dec 10, 2009
Tweaking the Windows 7 Registry
Jul 17, 2009
Running Scripts to Enhance and Improve Windows
Jun 11, 2009
Building a Budget PC
Jun 16, 2008
Accessing and Sharing Network Resources in Windows Vista
May 28, 2008
Programming the Windows Script Host
Apr 29, 2008
Tricks for Working with Word 2007 Documents
Mar 31, 2008
Building Basic Formulas in Excel 2007
Mar 26, 2008
Collaborating with Windows Meeting Space
Feb 15, 2008
Troubleshooting Tools Included with Windows Vista
Feb 15, 2008
Using Virtual Private Network Connections in Windows Vista
Feb 15, 2008
Implementing Group Policies with Windows Vista
Feb 8, 2008
Programming the Windows Script Host
Feb 8, 2008
Windows Vista's Stability Improvements
Feb 8, 2008
Adding Devices to the Windows Home Server Network
Sep 21, 2007
Understanding Program Variables in VBA
Jun 15, 2007
Designing Microsoft Access 2007 Forms for Efficient and Accurate Data Entry
May 4, 2007
Getting the Most Out of Windows Vista User Accounts
Mar 9, 2007
The Windows Vista Interface
Oct 6, 2006
Mastering File Types in Windows XP
Nov 4, 2005
Constructing Knockout Presentations in PowerPoint
Apr 22, 2005
Working with Multiple-Table Queries in Access
Sep 10, 2004
Building Basic Formulas in Excel
Aug 27, 2004
Understanding Program Variables in VBA
Apr 2, 2004
From Buck-Naked to Beautiful: Dressing Up Your Page
Jun 7, 2002
Performing Financial Calculations
Sep 2, 2001
Creating and Using Cookies
Sep 2, 2001
Encrypting Text with JavaScript
Sep 2, 2001
Making Form Fields Mandatory
Sep 2, 2001
Cross-Browser Solutions: Detection and Generic Functions
Sep 2, 2001
Understanding Variables in JavaScript
Jul 6, 2001
Formulas and Functions: Microsoft Excel 2010, Rough CutsFormulas and Functions: Microsoft Excel 2010, Rough Cuts
Feb 2, 2010
Microsoft Windows Home Server Unleashed, Rough Cuts, 2nd EditionMicrosoft Windows Home Server Unleashed, Rough Cuts, 2nd Edition
Jan 6, 2010
Mac OS X Snow Leopard In DepthMac OS X Snow Leopard In Depth
Sep 22, 2009
Mac OS X Snow Leopard In Depth App (iPhone)Mac OS X Snow Leopard In Depth App (iPhone)
Sep 22, 2009
Mac OS X Snow Leopard In Depth, Adobe ReaderMac OS X Snow Leopard In Depth, Adobe Reader
Sep 15, 2009
Microsoft Windows 7 UnleashedMicrosoft Windows 7 Unleashed
Jul 14, 2009
Microsoft Windows 7 Unleashed, Adobe ReaderMicrosoft Windows 7 Unleashed, Adobe Reader
Jul 8, 2009
Tweak It and Freak It: A Killer Guide to Making Windows Run Your WayTweak It and Freak It: A Killer Guide to Making Windows Run Your Way
Mar 27, 2009
Tweak It and Freak It: A Killer Guide to Making Windows Run Your Way, Adobe ReaderTweak It and Freak It: A Killer Guide to Making Windows Run Your Way, Adobe Reader
Mar 18, 2009
Build It. Fix It. Own It: A Beginner's Guide to Building and Upgrading a PCBuild It. Fix It. Own It: A Beginner's Guide to Building and Upgrading a PC
May 19, 2008
Build It. Fix It. Own It: A Beginner's Guide to Building and Upgrading a PC, Adobe ReaderBuild It. Fix It. Own It: A Beginner's Guide to Building and Upgrading a PC, Adobe Reader
May 7, 2008
Microsoft Windows Vista Unleashed, 2nd EditionMicrosoft Windows Vista Unleashed, 2nd Edition
Apr 4, 2008
Microsoft Windows Vista Unleashed, Adobe Reader, 2nd EditionMicrosoft Windows Vista Unleashed, Adobe Reader, 2nd Edition
Apr 4, 2008
Networking with Microsoft Windows Vista: Your Guide to Easy and Secure Windows Vista NetworkingNetworking with Microsoft Windows Vista: Your Guide to Easy and Secure Windows Vista Networking
Dec 19, 2007
Networking with Microsoft Windows Vista: Your Guide to Easy and Secure Windows Vista Networking (Adobe Reader)Networking with Microsoft Windows Vista: Your Guide to Easy and Secure Windows Vista Networking (Adobe Reader)
Dec 19, 2007
Microsoft Windows Home Server UnleashedMicrosoft Windows Home Server Unleashed
Sep 13, 2007
Microsoft Windows Home Server Unleashed (Adobe Reader)Microsoft Windows Home Server Unleashed (Adobe Reader)
Sep 13, 2007
Tricks of the Microsoft Office 2007 GurusTricks of the Microsoft Office 2007 Gurus
May 16, 2007
Tricks of the Microsoft Office 2007 Gurus (Adobe Reader), 2nd EditionTricks of the Microsoft Office 2007 Gurus (Adobe Reader), 2nd Edition
May 16, 2007
Microsoft Office Access 2007 Forms, Reports, and QueriesMicrosoft Office Access 2007 Forms, Reports, and Queries
May 1, 2007
Microsoft Office Access 2007 Forms, Reports, and Queries (Adobe Reader)Microsoft Office Access 2007 Forms, Reports, and Queries (Adobe Reader)
May 1, 2007
VBA for the 2007 Microsoft Office SystemVBA for the 2007 Microsoft Office System
Mar 30, 2007
VBA for the 2007 Microsoft Office System (Adobe Reader)VBA for the 2007 Microsoft Office System (Adobe Reader)
Mar 30, 2007
Formulas and Functions with Microsoft Office Excel 2007Formulas and Functions with Microsoft Office Excel 2007
Mar 14, 2007
Formulas and Functions with Microsoft Office Excel 2007 (Adobe Reader)Formulas and Functions with Microsoft Office Excel 2007 (Adobe Reader)
Mar 14, 2007
Microsoft Windows Vista Unleashed, Adobe ReaderMicrosoft Windows Vista Unleashed, Adobe Reader
Dec 8, 2006
Microsoft Windows Vista UnveiledMicrosoft Windows Vista Unveiled
Jun 9, 2006
Microsoft Windows Vista Unveiled, Adobe ReaderMicrosoft Windows Vista Unveiled, Adobe Reader
Jun 9, 2006
Special Edition Using JavaScript, Adobe ReaderSpecial Edition Using JavaScript, Adobe Reader
Feb 14, 2006
Microsoft Windows XP UnleashedMicrosoft Windows XP Unleashed
Sep 6, 2005
Microsoft Windows XP Unleashed, Adobe ReaderMicrosoft Windows XP Unleashed, Adobe Reader
Sep 6, 2005
Tricks of the Microsoft Office GurusTricks of the Microsoft Office Gurus
Apr 12, 2005
Microsoft Access 2003 Forms, Reports, and QueriesMicrosoft Access 2003 Forms, Reports, and Queries
Aug 18, 2004
Microsoft Access 2003 Forms, Reports, and Queries, Adobe ReaderMicrosoft Access 2003 Forms, Reports, and Queries, Adobe Reader
Aug 18, 2004
Formulas and Functions with Microsoft Excel 2003Formulas and Functions with Microsoft Excel 2003
Jun 11, 2004
Formulas and Functions with Microsoft Excel 2003, Adobe ReaderFormulas and Functions with Microsoft Excel 2003, Adobe Reader
Jun 11, 2004
Absolute Beginner's Guide to VBAAbsolute Beginner's Guide to VBA
Mar 9, 2004
Absolute Beginner's Guide to VBA, Adobe ReaderAbsolute Beginner's Guide to VBA, Adobe Reader
Mar 9, 2004
Unauthorized Guide to Windows Millennium, TheUnauthorized Guide to Windows Millennium, The
Sep 20, 2000
The Unauthorized Guide to Windows 98, 2nd EditionThe Unauthorized Guide to Windows 98, 2nd Edition
Aug 28, 1999

Sorry, this author hasn't posted any blogs.

Microsoft Windows XP Unleashed

This chapter is from the book
Microsoft Windows XP Unleashed

Microsoft offers scant documentation and tools for working with file types in Windows XP, presumably to protect the sensibilities of the novice user. Ironically, however, this just creates a whole new set of problems for beginners, and more hassles for experienced users. This sample book chapter remedies that situation. You'll learn the basics of file types, and then see a number of powerful techniques for using file types to take charge of the Windows XP file system.

in this chapter

  • Understanding File Types

  • Working with Existing File Types

  • Creating a New File Type

  • Associating Two or More Extensions with a Single File Type

  • Customizing the New Menu

  • Customizing Windows XP's Open With List

Amazingly, a long list of useful and powerful Windows XP features are either ignored or given short shrift in the official Microsoft documentation. Whether it's the Windows XP startup options, group policies, or the Registry (to name just three that I discuss in this book), Microsoft prefers that curious users figure these things out for themselves (with, of course, the help of their favorite computer book authors).

The subject of this chapter is a prime example. The idea of the file type can be described, without hyperbole, as the very foundation of the Windows XP file system. Not only does Microsoft offer scant documentation and tools for working with file types, but they also seem to have gone out of their way to hide the whole file type concept. As usual, the reason is to block out this aspect of Windows XP's innards from the sensitive eyes of the novice user. Ironically, however, this just creates a whole new set of problems for beginners and more hassles for experienced users.

This chapter brings file types out into the open. You'll learn the basics of file types and then see a number of powerful techniques for using file types to take charge of the Windows XP file system.

Understanding File Types

To get the most out of this chapter, you need to understand some background about what a file type is and how Windows XP determines and works with file types. The next couple of sections tell you everything you need to know to get you through the rest of the chapter.

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 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. As you learned in Chapter 2, "Exploring Expert File and Folder Techniques," Windows XP turns off file extensions by default. Here are just a few of the problems this allegedly document-centric decision creates:

Document confusion

If you have a folder with multiple documents that use the same primary name, it’s often difficult to tell which file is which. For example, Figure 3.1 shows a folder with 15 different files named Project. Windows XP unrealistically expects users to tell files apart just by examining their icons.

The inability to rename extensions

If you have a file named index.txt and you want to rename it to index.html, you can’t do it with file extensions turned off. If you try, you just end up with a file named index.html.txt.

The inability to save a document

Similarly, with file extensions turned off, Windows XP forces under an extension of your choice you to save a file using the default extension associated with an application. For example, if you’re working in Notepad, every file you save must have a .txt extension.


Figure 3.1

Figure 3.1 With file extensions turned off, it’s often difficult to tell one file from another.

You can overcome all these problems by turning on file extensions. Why does the lack of file extensions cause such a fuss? Because file extensions solely and completely determine the file type of a document. In other words, if Windows XP sees that a file has a .txt extension, it knows 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 XP associates that extension with Notepad, so the file will always open in Notepad. Nothing else inherent in the file determines the file type so, at least from the point of view of the user, the entire Windows XP file system rests on the 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.) However, it also leads to some powerful methods for manipulating and controlling the Windows XP file system, as you’ll see in this chapter.

File Types and the Registry

As you might expect, everything Windows XP knows about file types is defined in the Registry. (See Chapter 8, "Getting to Know the Windows XP Registry," for details on understanding and using the Registry.) You use the Registry to work with file types throughout this chapter, so let’s see how things work. Open the Registry Editor 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 more than 300 such subkeys in a basic Windows XP 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 that are associated with the registered extensions. When an extension is associated with a particular file type, the extension is said to be registered with Windows XP.

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

Figure 3.2

Figure 3.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.3shows 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
Figure 3.3

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

The File Types Tab: A Front-End for HKEY_CLASSES_ROOT

For much of the work you do in this chapter, you won’t have to deal with the Registry’s HKEY_CLASSES_ROOT key directly. Instead, Windows XP offers a dialog box tab that acts as a front-end for this key. Follow these steps to display this tab:

  1. In Windows Explorer, select Tools, Folder Options to display the Folder Options dialog box.

  2. Select the File Types tab.

Figure 3.4 shows the File Types tab. The Registered File Types list shows all the file types known to Windows XP, as well as their extensions. When you select a file type, the Opens With line in the Details area shows you the icon and name of the program associated with the file type.

  • Share ThisShare This
  • Your Account

Discussions

Issue with jpg file type
Posted Dec 12, 2008 09:04 AM by rsklein.news
0 Replies

Make a New Comment

You must log in in order to post a comment.

Related Resources

Jennifer  BortelWin FREE iPhone Developer Books and Videos- Introducing @InformIT Giveaways
By Jennifer Bortel on February 5, 2010 No Comments

Apples’s recent iPad announcement made our hearts flutter so we couldn’t resist making an announcement of our own!

Today marks the first ever @InformIT Giveaway!

We’ll regularly post a video like this one profiling spectacular prizes we’re giving away—from books and videos to T-shirts and other exciting stuff. Check out the video below to see the giveaways for today, and then scroll down for more prize details and instructions on how to win them!

So Far So Good
By John Traenkenschuh on February 2, 2010 No Comments

So far, Win 7 is making a thoroughbred of what has been a plough mule laptop

Dustin Sullivan"Every OSX developer should have this book on their desk."
By Dustin Sullivan on February 1, 2010 No Comments

That was the sentence Mike Riley ended his recent Dr Dobb's CodeTalk review of Cocoa Programming Developer's Handbook with.

See All Related Blogs

Informit Network