Creating file associations
Generally speaking, an association is a link between two separate things. File associations link the file extensions of filenames to the programs that can be used to open the files. When dealing with Windows, file associations let the OS know what program should be used to open a specific type of file. This information is stored in the Registry, but can be accessed from a number of locations. The Registry is a central location that stores configuration and settings for Windows XP. Any files that are not associated with an application will have a generic Windows icon.
Tip: Before OS X, Macintosh systems did not use file extensions for associations. Instead, each file was saved with both a data and a resource portion. The resource portion contained the file type and associated application information. Windows-based files are saved only with a data portion. In OS X, files no longer contain a resource portion, and use file extensions to define types of files.
There are a number of different ways to associate file types with applications:
- By double-clicking unassociated files and assigning an application in the dialog boxes that follow
- By pressing Shift while right-clicking on associated files and selecting an Open With... option
- By using the Folder Options dialog box
- By editing the Registry
Tip: When working with Windows 2000 or newer systems, you will not usually need to hold down the Shift key to get the Open With options. Windows XP will also display a nested menu with recently chosen options for that file type, making it easier to switch between applications for that file type.
Warning: Since there are ways other than the Registry, editing the Registry is not the recommended way. Microsoft does not recommend editing the Registry directly with the Registry editor, even though it is required from time to time. If you make a mistake with the Registry, you may have to reinstall the operating system.
For any files that are not currently associated with an application, you can double-click the file. Windows checks its list of associations; when it can not locate one, it prompts you for the name of the application that should be used. This dialog box gives you the option to Always Use the Selected Program to Open This Kind of File, which, when selected, places an association with the file extension in the Registry. This is by far one of the easiest ways to create file associations. This process is easier when using Windows XP, which also offers to check with Microsoft to see what program can be used with that file extension, in addition to letting you choose it manually.
If you are not sure about which program you should use, when you are at the Open With dialog box, you can clear the Always Use the Selected Program to Open This Kind of File check box prior to choosing the application you want to use with the file. The file will be opened by the application you chose, but the association will not be recorded in the Registry, so if you chose the wrong application, you can just double-click the file and choose another application.
If you make a mistake or need to change the application that opens a file, you can easily do this through the shortcut menu. First select the file (if you don't do this, then the Open With option will be missing) and then right-click the icon. In the shortcut menu, you should see an option for Open With. If you are using Windows 2000, when you choose Open With, you will see the same dialog box you saw with unassociated files, while if you are using Windows XP, Open With will be a nested menu, and you will also have to select Choose Program. Once again, by selecting Always Use the Selected Program to Open This Kind of File, you will be able to associate the file extension with the application you select this time through the dialog box.
If you're looking for a few more options, check out the Folder Options dialog.
To get to Folder Options, follow these steps:
- Open any directory window, such as My Computer.
- Open the Folder Options dialog box:
- If you're using Windows 9x, choose View → Folder Options.
- If you're using Windows 2000 or newer, choose Tools → Folder Options.
- When the Folder Options dialog box opens, click the File Types tab to see all of the file associations currently in the Registry.
Windows XP makes this dialog box easy to work with by actually listing all of the file extensions in the top pane. To change the program that is associated with an application, click the Change button. This opens the Open With dialog box. From there, you choose a new application for that extension. The dialog layout and use is a little more confusing with earlier versions of Windows.
If you select a file type and click the Advanced button shown previously, you will see the Edit File Type dialog box featured. This dialog box allows you to set additional options for this type of file. These options are located under the Actions section of the dialog box and include:
- Confirm Open after Download: This option causes a dialog box to appear after using Internet Explorer to download files with this extension. The dialog will confirm that you want to open the file.
- Always Show Extension: Even when Explorer is set up to hide extensions, if this option is selected, the extension will still appear for files of this type.
- Browse in Same Window: When loading these files into Internet Explorer, this lets Internet Explorer know if it should open a new window to show the file or if it should show the document in the current default window.
If you select one of the listed Actions, you will be able to modify how the action is performed on the selected file by clicking the Edit button and modifying the dialog. In doing so, you will be able to specify the full path to the program to open this file type along with any switches that should be used for that particular program. For example, if the extension has open, print, and printto actions, then the field Application used to perform action for the open action may look like this:
In this example, %1 is used by Windows to represent the name of the file that you are working with. When working with the print action, the line may look like this:
C:\WINNT\system32\NOTEPAD.EXE /p %1
Finally, for the printto action, you line might look like this:
C:\WINNT\system32\NOTEPAD.EXE /pt %1
Most applications will support opening files from a similar command, while fewer will support printing, or printing to a specific device.
Remember: Not all applications support printing for the Windows Explorer shell, but for those that do, you can either right-click the file and choose Print or drag them to a printer icon. Dragging the icon to the printer will make use of the document's printto action.
In this tutorial:
- Managing Files and Directories
- Identifying File-Naming Conventions
- Long and short filenames
- Creating file associations
- Understanding file extensions
- Compression utilities Extensions
- Graphic files Extensions
- Understanding File Attributes
- The basic attributes
- Windows 2000 and Windows XP extended attributes
- Setting basic attributes