PATH: Instructional Server> Computer Basics>

Windows® File Association


Of all the concepts that one should learn in order to easily understand and use the Windows® operating system (and others to a lesser degree), the most pivotal is undoubtedly the concept of file association. Oddly, this topic is seldom directly addressed in computer textbooks or tutorials. Rather it is slowly learned indirectly as the result of gradual recognition of the manner in which our computers seem to respond to our actions. And yet file association directly affects how we must execute even the most basic commands on Windows-based computers and why one computer often reacts differently to a command or user action than another computer. The purpose of this document is to explain in basic terms what file association is and how you can make use of it to control your computer.

Like almost all topics in computers, this one is fundamentally based on the concept of data languages. Readers are advised to review the web page about computer data types and languages prior to reading this document to develop a literacy regarding terms such as "text", "binary", and "extension".

What's in a name?

Most computer users know that they are expected to assign a label to every file of data that they store regardless of which program is doing the saving. We can deduce from this that the process of naming files is performed by the operating system (Windows in our case) rather than by the many individual applications programs (such as word processors or accounting systems). Every operating system defines rules that must be followed when selecting filenames. Some operating systems use filenames simply as unique labels to allow easy retrieval of the data later. But other systems place far more importance on these names than just using them as simple labels. Windows allows users to assign a suffix known as an "extension" to the end of a file label following a period to be used as an indicator of the data type (computer language) contained within the file. File extensions are examined by Windows and applications programs to determine what actions are appropriate with each file based on its data type. For example, the extension ".exe" (short for executable) is often used to indicate that a file contains machine language (program instructions). Such files cannot be displayed on a computer screen without prior translation because they do not contain the "text" type of data that screens can decipher. Their language is understood only by processors. As such, the most appropriate action to perform upon these files is to send them to the processor for execution. Windows was written to recognize this fact. Thus when a user sees a file named "game.exe" listed in a folder, the user can execute that program by typing simply game, rather than having to include the extension and type game.exe (which is also allowed).

It is important to realize and remember that file extensions are used only as indicators of a file's data type, but not as guarantees. In other words, a file's extension is not what defines it's data type. Files can be improperly labeled with the wrong extension. For example, simply recording the extension ".exe" at the end of a filename does not make the file executable. For a file to be executable, it must be recorded by a programming language translator that knows the machine language of the type of processor on which it will be run. The definition of a file's data type is a function of the language abilities of the program that writes it and actually has no dependence on the extension used to label the file.

The computer industry has standardized (somewhat) upon common usage of extensions to indicate specific data types, but there are many variations, dualities, and conflicts as well. Here are some basic facts about extensions to help you develop a sense of how they are used in Windows.

File Classification

Operating systems treat all stored files as belonging to one of two major categories:

User Interfaces

An essential component of every PC operating system is a program (or set of programs) called the user interface. This software addresses a fundamental limitation of today's computers - they don't understand human languages such as English. Computers can manipulate many languages, but they do not understand them. In fact, the only language that is native to a computer is the binary machine language of its processor (which is not intelligible to humans). A user interface is the part of the operating software that allows people and computers to interact with each other. User interfaces translate our actions (such as typing commands or clicking on icons) into machine instructions recognizable by the processor in our computer.

User interfaces come in a few basic types:

Methods of Control

Software designers who write operating software such as Windows must devise a method for users to follow when they want to load a program and manipulate a data file. Historically, two opposite approaches have been used for this purpose.

The program-oriented approach has been the one most commonly used by computer programmers over the years. Most command-line user interfaces use this method of control. In the example provided above about how to load and use the Paint program to manipulate a picture file named "mypic.bmp", the command line was:

    mspaint.exe mypic.bmp

The use of the ".exe;" extension is optional, but the order of the words on the command line is not. The program name is typed first (acting as a verb), followed by the name of the data file (serving as an object to be acted upon). This format indicates first what program is being loaded by the command. The name of the data file that follows is subsequently passed to the program (once it is loaded into memory) so that it knows what data file to load. This program-oriented approach also can be used in the graphic (point-and-click) interface of control offered by the Windows Desktop. In this approach, a user starts by clicking on the [Start] button and selects the name of the program to be loaded. After it is loaded, the user uses the program's menus or quick keystrokes to load (or "open") the data file.

It has been discovered after studying the preferences of ordinary computer users (non-programmers) that a majority of them prefer the data-oriented approach for its simplicity. This means that laypeople focus more on their data than on the processes that manipulate that data. However, the data-oriented approach is not free from problems. It relies on the operating system to always know which program should be used to manipulate each data file. It is not unusual for us to have more than one program that is capable of manipulating a given type of data. In this event, you might choose to use the program-oriented approach to controlling your computer, where you select the preferred program first and then use it to load the data. The other option is to rely on file association. (Finally - we're here!)

File Association - How the Data-oriented Approach to Computer Control Works

In order to facilitate the data-oriented approach to computer control, Windows and other operating systems maintain a table that associates different types of data files with specific programs on your computer. Microsoft refers to this table as the list of "registered file types" (although many in the industry call it the file association table). In Windows, it is stored on your hard disk in a group of files called the registry. (In fact, the registry is where almost all of the essential Windows configuration data is stored.) When Windows is installed on a computer, a basic table is stored containing a list of the most widely known and used file types, such as: text, bit-mapped graphics, executable machine language, hypertext documents (web pages), etc. Although this table starts out the same for each version of Windows, it quickly becomes unique on every computer. As software is installed on each computer, this table is updated and new file types are added to the list. For each file type, Windows records:

Weaknesses of the File Association System

Users need to be aware that the list of "registered file types" maintained by the operating system is not comprehensive. Many types of files can be stored on a computer that are not listed in the registry. This can happen if you save a data file and give it a non-standard or incorrect extension, or if you copy a file to your computer that was not recorded by one of the programs on your computer. You may have experienced a situation where you attempted to activate a data file that you saw listed in a folder and received an error message asking what program to use to open the file. This means that the extension on that file was not listed in the registry on the computer that you were using. It does not mean that you don't have a program capable of reading the file; it simply means that there is no record of which program can do so listed in the registry of your computer. You would still have the option of using the program-oriented approach to open the data file, but you might have to do so by trial-and-error.

How to tell what your computer knows

If you look at the icon displayed along with each file in folders, you will notice that some of them match those of programs on your computer, and others do not. For example, in Windows, the icon displayed next to files with a ".txt" extension is usually the icon for the Windows® Notepad (text editor) program. If you see an icon next to a file that has the generic Windows icon icon showing a generic program window, then that file's extension (and therefore its data type) is not recorded in the registry of your computer. You can add any file extension to the list of registered file types. The process differs a bit depending on which operating system you have, but basically it is accessed like this:

  1. Open any folder window.
  2. Select or create a file with the extension that you want to define.
  3. Right-click the file and you should see a choice of Open with (or similar).
  4. Hover over it and select the menu choice Choose default program (or similar).
  5. Select or browse to the program you want to set as the owner of the selected file type (based on its extension), but do not close the dialog box yet.
  6. Look at the checkbox named Always use the selected program to open this type of file. If you want your program choice to permanently be used to open the selected data file, then check the checkbox. If you want your program choice to open the selected data file only this one time, uncheck the checkbox.
  7. Complete the definition by clicking the OK button.

Make these changes with extreme caution. Mistakes here can have serious effects on how your computer behaves. For more information, use the help features of your operating system.

How get your computer to tell the whole truth

Mac users, read: [www.fileinfo.com/help/mac_show_extensions]

After installing Windows, if you look at file labels listed in folders, you might discover that some of them do not show their extension. Windows has a setting that is stored in the registry (initially) that hides the extensions of known (listed) file types. You can disable this setting to have Windows show you the extensions all files. The process differs a bit depending on which version of Windows you have. For Windows XP, the steps are:

  1. Open any folder window.
  2. Click on the menu choice Tools (or View if Tools is not there).
  3. Select Folder Options from the menu.
  4. Click on the tab labeled View at the top of the dialog box that appears.
  5. Clear (click on) the check mark next to the item in the list that says "Hide file extensions for known file types".
  6. Click on the OK button at the bottom of the dialog box.

For the procedure in Windows Vista, see the Microsoft web page at:

     [http://windows.microsoft.com/en-us/windows-vista/Show-or-hide-file-name-extensions]

For the procedure in Windows 7, see the Microsoft web page at:

     [http://windows.microsoft.com/en-US/windows7/Show-or-hide-file-name-extensions]

If you are denied access to the Control Panel in Windows 7 (which would prevent the use of the procedure listed above), an alternative approach would be as follows:

  1. Open any folder window.
  2. Click on the button labeled Organize.
  3. Select Folder and search options from the menu.
  4. Click on the tab labeled View at the top of the dialog box that appears.
  5. Clear (click on) the check mark next to the item in the list that says "Hide file extensions for known file types".
  6. Click on the OK button at the bottom of the dialog box.

After following any of the procedures listed above, you should then see all file extensions listed when viewing file names in your folders. Note that you will be expected to also maintain these extensions yourself when naming or renaming files if you alter this setting to stop hiding the known extensions.

For more information about how the Windows user interface works, view the Tutorial Videos About Windows on this web site.

PATH: Instructional Server>