PDA

View Full Version : Working with File Types and File Associations


Micron
02-04-2006, 04:54 PM
The File Types tab of the Folder Options dialog box (choose Tools, Folder Options, File Types) displays a list of your registered document file types.

By selecting file types from the Registered File Types list, you can perform a number of tasks:

Change the default action for a file type

Change the application associated with a file type
Change a file type's icon
Specify whether the file type's extension should be displayed in Windows Explorer
Specify whether a file type should be opened immediately after being downloaded
Add commands to the file type's shortcut menu

http://www.experiencewindows.co.uk/images/ft1.jpg

Changing the Default Action for a File Type

A file type's default action is the one that occurs when you double-click it (or single-click it if you've set up Windows Explorer for single-click starting). If you right-click a file in Windows Explorer, the default action is shown in boldface on the shortcut menu. Most commonly, the default action for a document is to open it for editing or display in its parent application-the application with which it is associated. There are exceptions, however. The default action for a .reg file, for example, is to merge the file's data with the registry. To edit the .reg file, you need to choose a nondefault command (Edit) from the shortcut menu. (Alternatively, you can change the default action to Edit.)

To change a file type's default action, follow these steps:

In the File Types list, select the file whose default action you want to change.
Click Advanced.
In the list of available actions, select the action you want to be the default.
Click Set Default. This figure shows the result of setting .tif files to be opened by default.

Changing the Application Associated with a File Type

Perhaps the simplest way to change the application associated with a file type is to right-click it in Windows Explorer and choose Open With from the shortcut menu. In the Open With dialog box, select the application you want associated with the file type, and then select Always Use The Selected Program To Open This Kind Of File.

http://www.experiencewindows.co.uk/images/ft2.jpg

Alternatively, you can accomplish this change in the File Types list. Select the file you want to change, click the Change button, and then select the program you want associated with the file type.

Changing a File Type's Icon

To change the icon used for a file type, follow these steps:

Select the file type in the File Types list.
Click Advanced.
Click Change Icon.
Choose a new icon from the Change Icon dialog box.

If you don't find an icon to your liking in the Change Icon dialog box, click Browse and navigate to another program that might offer something you prefer.

Making the Extension of a Particular File Type Visible
If you have set Windows Explorer to hide extensions for known file types (that is, if you have left its default behavior in place), you can still display extensions for particular kinds of files. In the File Types list, select the file type whose extension you want to see. Then click Advanced and select Always Show Extension.

Specifying Download Behavior

To specify that files of a particular type should always be opened as soon as you have finished downloading them, select the file type in the File Types list. Click Advanced and then clear Confirm Open After Download.

Caution: Indiscriminately opening certain types of files you download could be disastrous to the health of your computer if those files contain viruses or worms. Files with extensions that indicate they are executable files are the ones you need to watch most carefully, such as .bat, .vbs, .exe, or .com.

Editing a File Type's Shortcut Menu

When you right-click a file or folder in Windows Explorer, you get the familiar shortcut menu of commands available for that object. The commands that appear on this menu can be derived from the following locations:

HCKR\class \Shell (where class is a descriptor of the file-such as txtfile for files with the extensions .dic, .exc, .log, .scp, .txt, .wtx, and possibly others on your system)

HKCR\*\Shell
HKCR\Unknown\Shell
HKCR\class \Shellex\ContextMenuHandlers
HKCR\*\Shellex\ContextMenuHandlers
The file %SystemRoot%\System32\Shell32.dll

Those that appear under HKCR\class \Shell are file-type specific. Those that appear under HKCR\*\Shell and HKCR\Unknown\Shell work just like the ones under HCKR\class \Shell except that they apply to all file types (*) or to unregistered file types (Unknown).

Those that appear under either of the ContextMenuHandlers keys are shell extensions provided by .exe or .dll files. And those that come from Shell32.dll are the so-called canonical verbs-Cut, Copy, Paste, Delete, Rename, and Properties.

You can edit the commands that appear under the Shell keys or add new commands there. But you don't need to go to the registry to do this unless you want to manipulate the *\Shell or \Unknown\Shell keys. To modify shortcut-menu commands for registered file types, use the File Types list in Windows Explorer. It's safer and just as effective.

To edit an existing command, follow these steps:

Select the file type in the File Types list.
Click Advanced.
In the Actions list, select the command you want to edit.
Click Edit.

Make your changes on the Action line, and then click OK.

To add a new command, select the file type in the File Types list, click Advanced, and then click New. On the Action line of the New Action dialog box, type the command as you want it to appear on the shortcut menu. On the Application Used To Perform Action line, type the command string you want to use.

For example, .log files are associated with Notepad, by default. Suppose you would like to open them occasionally in WordPad instead-perhaps in order to apply some formatting for reporting purposes. You can use Open With to open the files in WordPad, of course, but let's assume that you'd like to streamline the process by having an Open With WordPad command on the shortcut menu. Here's how to do it:

In the Extensions column of the File Types list, select LOG.
Click Advanced.
In the Edit File Type dialog box, click New.
Fill out the New Action dialog box

The ampersand before WordPad is optional; it makes the letter W a shortcut key for the new command. The %1 at the end of the command string is a placeholder for the name of the file that you right-click.

Note: Because .log files belong to the class txtfile, making this shortcut-menu change for .log files also adds the new command to the shortcut menus for the other txtfile types-.txt, .dic, and so on.
To add a command for the * or Unknown file types, follow these steps:

Open Registry Editor.
Navigate to HKCR\* or HKCR\Unknown.
If the Shell subkey doesn't exist, create it.
Create a subkey under Shell and then give it the name of your new command.

Make the default value of your new command subkey the text that you want to appear on the shortcut menu. Create a new subkey called Command under the subkey you just created. Make the default value for this new subkey the command string that you want your command to execute.

Caution: Use extreme care when editing the registry directly. Don't make changes in the registry when an alternative method exists. To modify shortcut menus, use the File Types list in Windows Explorer if possible. For more information about working directly with the registry