- Advanced File Management with Windows Explorer
- Changing the Appearance of a Folder's Contents
- Managing Files and Folders
- Customizing the Send To Menu
- Using the Recycle Bin
- Searching for Files
- Associating Files with Programs
- Working with Compressed Files
- Working with Long Filenames
- Troubleshooting
- Secrets of the Windows Masters: Inside Information About Your Files
Associating Files with Programs
Whenever you double-click an icon, Windows checks the file's extension against a database of registered file types to determine which action to take. A registered file type might have multiple actions (Open, Edit, and Print, for example), all of which are available on the shortcut menu when you right-click a file of that type. Windows uses the default action when you double-click the icon. If Windows does not recognize the file type, it displays a dialog box and lets you choose which application to use with the file you've selected.
In Windows Me, Microsoft has completely redesigned the interface through which you manage the associations between file types and programs. The procedure is still complicated, but it now includes some safeguards that let you undo changesa welcome improvement over Windows 95 and 98.
In this section, I explain how to change the default action associated with a given file extension, and how to undo those changes. I also show how to add or edit actions for a registered file type. Before you begin messing with these system settings, however, it's crucial you understand the basic workings of file types and extensions.
NOTE
If you read other Windows books, you'll discover that most authors gloss over this topic because it's so incredibly complex. Much of the material in this section is documented for the first time here.
How File Types and Extensions Work
File extensions have been around since the very first version of DOS. Beginning with the first release of Windows 95, Microsoft began tracking file types as well. In Windows Me, Microsoft has finally made it possible to work with file extensions and file types separately.
File types are inextricably linked to file extensions, but the relationship isn't always easy to understand. Here are the essential facts you need to know:
-
File types typically have plain-English names (HTML Document), whereas extensions are typically three or four letters (HTM or HTML).
-
File types are listed in their own column when you choose Details view in Windows Explorer. You also can inspect a file's properties to see which file type is associated with it. Extensions for registered file types are hidden by default; extensions for unregistered file types are always visible in the Explorer list.
-
Every file type has an associated icon, which appears when you view files of that type in Windows Explorer or a folder window.
-
Every unique file extension is associated with one and only one file type at a time. After you install Microsoft Word, for example, indows associates the DOC extension with the Microsoft Word Document file type.
-
A file type, on the other hand, can be associated with multiple extensions. The HTML Document file type works with both HTM and HTML extensions, and files of the JPEG Image file type can end with the extension JPE, JPEG, or JPG.
-
As the previous examples illustrate, a file extension can be more than three letters long. In fact, a file extension can consist of more than 200 characters.
-
Windows common dialog boxes (File Open and File Save As) include a drop-down File of Type list. Choose a file type from this list, and Windows adds the default extension for that file type automatically when you save a document.
-
A Windows filename can contain more than one period. Windows defines the extension as all characters that appear after the last period in the filename.
TIP
Evildoers who write viruses often take advantage of the fact that extensions for registered file types are hidden. The infamous LoveLetter virus, for example, attached itself to email messages as a file called LOVE-LETTER-FOR-YOU.TXT.vbs. The vbs extension was hidden by default on most systems; without the extension, this looks like a simple text file, doesn't it? If you reconfigure the default Explorer settings so that all extensions are visible, the camouflaged file extension is easier to spot. To do so, open the Folder Options dialog box, click the View tab, and uncheck the Hide File Extensions for Known File Types box.
Most application programs handle the details of registering file types and associations when you install them. Creating a file type manually and editing an existing file type are cumbersome and difficult tasks best left for programmers. By far the best way to register a new file type is to do so by installing a program, where this chore is one of the Setup program's normal duties.
Viewing File Associations
To see a list of all registered file types, open an Explorer window, choose Tools, Folder Options, and then click the File Types tab.
Unlike previous Windows versions, which showed only the file type, Windows Me displays the file extension and file type. Click either heading to arrange the list in alphabetical order by that column. When you select an entry from the list, information about that file extension, its associated application (if any), and its registered file type appear at the bottom of the dialog box (see Figure 3.16).
Figure 3.16 Use this list of registered file types and extensions to specify which program is associated with a given file type.
Using an Alternative Program to Open a Registered File Type
You might have several programs at your disposal with which you can view or edit a particular type of file. For example, you can edit a text document (with a TXT extension) in Notepad, WordPad, Microsoft Word, or any one of dozens of alternative text editors. Unfortunately, Windows forces you to associate one and only one program with the default action for each registered file type. As a result, when you double-click the icon for a text document, that document opens in the program associated with that file type.
You can override the default association at any time and choose a specific program you want to use for a given file icon without changing file associations. Say, for instance, that you want to use WordPad to open a text document. Perform the following steps to add WordPad to the Open With list for text documents; after you do so, WordPad and Notepad will be available as options whenever you right-click a file of that type and choose Open With. Follow these steps to get started:
- Select the document icon, right-click, and choose Open With from the shortcut menu. If this is the first time you've used the Open With menu for this file type, the Open With dialog box appears (see Figure 3.17). Use this dialog box to open a document with the application of your choice instead of the default program. If you've already assigned other programs to the Open With menu, select Choose Program from the bottom of the cascading menu.
- Scroll through the list and select the program you want to use to open files with this extensionin this example, it's WordPad. If the program you're looking for isn't on the list, click the Other button, browse for the program's executable file, and then click Open.
-
Before you click OK, note the checkbox labeled Always Use This Program to Open This Type of File. By default, this box is unchecked. Do not add a check mark unless you want to change the program associated with the Open action for files with this extension.
-
Click OK to open the document in the specified program.
NOTE
Note that the list of programs in the Open With dialog box shows the full name of the registered application, if available. This is a significant improvement over previous Windows versions, which showed only the short name of the executable file and forced you to guess which program it launched.
After you go through this process the first time, Windows adds the program you chose to the cascading Open With menu. In the future, you can choose the program you want by right-clicking and using this menu. Figure 3.18 shows the shortcut menu for a text document after making this modification.
Have you accidentally added the wrong program to the Open With list? For instructions on how to remove these menu items, see "Cleaning Up the Open With List" in the "Troubleshooting" section at the end of this chapter.
Figure 3.18 Windows remembers when you use an alternative program to open a file with a given extension and adds its name to the Open With menu.
Changing File Associations by Extension
What happens if you decide you always want to use a particular program to open files with a specific extension? Making this sort of change is trivially easy. You can configure Windows so that WordPad opens instead of Notepad when you double-click a file with a TXT extension, for example. And unlike in previous Windows versions, undoing your changes and restoring the original association is also easy:
-
Right-click a file that ends with the extension you want to edit and choose Properties.
-
In the Properties dialog box, note that the General tab includes the file type and the name of the program currently registered to open it (see Figure 3.19). Click the Change button.
-
In the Open With dialog box, select the program you want to use to open all files with this extension. If the program you're looking for isn't on the list, click the Other button, browse for the program's executable file, and then click Open. Note that the Always Use This Program to Open These Files box is checked and cannot be changed.
-
Click OK to make the change, which is reflected immediately in the Properties dialog box for the file.
Figure 3.19 The Change button, new in Windows Me, lets you quickly change the program that opens when you double-click files with a given extension.
This feature works by taking advantage of a new Registry key not found in previous Windows versions. When you use the Change button to select a new program for use with a particular file extension, Windows adds or changes the subkey for that extension in the following Registry key:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\
Windows maintains a record of the previous file type in the Registry, as well. If you discover you made a mistake, and you want to change the association back to its original setting, open the Folder Options dialog box, click the File Types tab, select the extension, and click the Restore button. Note that this option is available only if you've changed the default settings for an extension.
Changing Advanced File Association Properties
In the previous section, I described the simplest configuration option for a file associationone action for one extension. But Windows has a much more powerful way of associating actions with file types.
As we saw earlier, a file type can define multiple actions and can apply to files with different file extensions. For instance, the file type HTML Document is associated with two extensions, HTM and HTML. When you double-click a file with either of these extensions, it opens in Internet Explorer. When you right-click the same file, you see several custom choices on the shortcut menu.
To see where those menu choices come from, open the Folder Options dialog box, click the File Types tab, and select one of these extensions. The description at the bottom of the dialog box explains that files of this type open with Internet Explorer. Now, if you click the Advanced button to open the Edit File Type dialog box, you can see that four default actions are associated with this file type (see Figure 3.20).
Figure 3.20 When you add a new action to this list, it appears on the right-click shortcut menus for that file type.
TIP
One of the greatest of all Windows annoyances crops up when two applications arm-wrestle over which one gets the rights to a given file extension. Windows Media Player and RealJukebox, for example, regularly tussle over which program gets the right to play MP3 audio files and music CDs. In general, Windows defers to whichever program was most recently installed. Some programs (including RealJukebox) offer the option to reclaim file associations automatically when another program "hijacks" the file types it normally uses. If you can't find that option, the easiest choice is usually to reinstall the program you prefer. The setup process typically edits the Windows Registry and adjusts all file association properties.
Use the Edit File Type dialog box to perform any of the following tasks:
-
Change the name of a file typeThis name is what appears in the list of file types; more importantly, it also appears in the File Type column when you switch to Details view in an Explorer window. Edit this text by typing over the contents of the text box.
-
Choose a different icon for the selected file typeClick the Change Icon button to do this.
-
Create a new actionClick New to begin building a new action from scratch.
-
Remove an actionClick Remove to delete an action completely. This option should be reserved for custom actions you created and no longer need.
- Edit an existing action Click the Edit button to change the command associated with the selected action. Follow these steps:
CAUTION
It's possible to completely eliminate a file type or an action associated with a file type. Generally, however, such a drastic step is not recommended. The settings for each file type take up a trivial amount of space in the Windows Registry, and removing a file type can cause installed programs to fail.
-
Select the file type you want to change and click the Edit button. The Edit File Type dialog box appears.
-
Select an entry from the Actions listthe default action is in bold typeand click the Edit button. The dialog box shown in Figure 3.21 appears.
-
Click the Browse button. In the dialog box that appears, find and select the executable (EXE) file for the program you want to use with the selected action; then click Open.
-
The filename you selected now appears in the Application Used to Perform Action text box. Add any command-line switches or replaceable parameters, if necessary. Click OK to close the Editing Action dialog box and save your changes.
-
Repeat steps 24 for other actions you want to change. When you finish, click OK to close the Edit File Type dialog box. Then, click OK again to close the Folder Options dialog box.
CAUTION
Note that some actions require dynamic data exchange (DDE), an extremely complex process that passes information between programs; if you see these options listed, exit this dialog box and don't attempt to edit the action by hand.
TIP
As a rule of thumb, it's always a good idea to enclose the entire program command in quotation marks when creating or editing an action. Also, consider adding the replaceable parameter "%1"(including the quotation marks) after the command. This parameter tells Windows to add the selected filename after the command, and the quotation marks ensure that any spaces in the filename will be interpreted properly.
Three options in this dialog box are worth noting:
-
Confirm Open After DownloadAs a security precaution, this option is on for most file types by default (it's off for MP3 files and other media types designed to play directly in a browser window or in Media Player). If you're certain that a particular file type is safe, you can clear this checkbox for a given file type, and it will automatically open in the associated application when you download it.
-
Set DefaultChoose an action and click the Set Default button to make that action the one that executes when you double-click a file of that type. The previous default action still appears as a choice on right-click shortcut menus.
- Always Show ExtensionCheck this box to display the file's extension in all Explorer and folder windows. This setting is useful if you regularly change the extensions of certain types of documents (such as TXT documents, or RTF documents created by Office 97 and Office 2000) but don't want to clutter the Explorer window with other extensions.
TIP
You can use this option to protect yourself from some script-borne viruses. Normally, Windows defines files with the VBS, JS, and SHS extensions as scripts to be run when double-clicked. If you set the default action to Edit instead of Open, double-clicking a script icon opens the script in Notepad, so you can see what it does. If you determine it's okay to run, go back to the Explorer window, right-click the file, and choose Open from the shortcut menu.
Opening an Unrecognized File Type
When you double-click an icon whose extension isn't registered, Windows displays a dialog box similar to the one that appears when you right-click and use the Open With menu choice. Two crucial differences that distinguish this dialog box enable you to quickly create a new file type for the unrecognized extension:
-
This version of the Open With dialog box includes a text box at the top. Enter the name of the new file type there.
-
By default, the box labeled Always Use This Program to Open This Type of File is checked. Remove this checkmark if you don't want to create a new file type.
If you accidentally create a new file type from this dialog box, you easily can remove that file type. Open the Folder Options dialog box, click the File Types tab, select the newly created file type, and click the Remove button.