File associations and OLE information

by Wayne Maples [Published on 20 April 2004 / Last Updated on 20 April 2004]

HKEY_CLASSES_ROOT contains file associations and OLE information. Contains all the information necessary to launch applications:
  • Holds information about the ActiveX controls installed. When an ActiveX control installs itself, it creates entries so that ActiveX container applications can find and use the control. These controls register themselves by name and they also have a unique numer called a class ID (CLSID).
  • All the extensions and associations between applications and documents
  • Names of all the drivers
  • Strings used as pointers to the actual text they represent (for example, aufile actually represents AU Format Sound)
  • Class ID numbers (numbers used intead of names for accessing items)
  • DDE and OLE information
  • Icons used for applications and documents
It controls all the data files. It is nearly identical on NT and Win95. Every file type is assigned a CLSID number. For example, the CLSID key for a .BMP extension lists the file type, the default app used for editing, running or printing the document, the default icons, and other info required to use the .BMP file type. Associations define what program runs when you double-click on a file name, what Context menu items appear when you right-click on the file.

To change a file association, use the Explorer's Folder Options dialog or in NT, use the ASSOC command which is an indirect registry editor for associations. Typing ASSOC at the commandline with no parameters displays all currently defined associations. This can be a long list. It is a good safety practice to store a copy of your associations for later referral should you or an application mess up one or more associations. To save a copy of your associations:

assoc > c:\data\mypc\fileassociations.txt

This also places the list into a file which you can view at your leisure with notepad or your editor of choice. The associations are to Windows internal names, not the program names we are more familiar with.

Typing ASSOC followed by an extension (including the initial period) displays the current association for the extension. Adding an equal sign and a file-type name actually creates the association between the extension with that file type. To remove an association, type ASSOC followed by the extension name and an equal sign, for example:

ASSOC .ELM=.

would remove the association on my PC of .elm with ELMFile.

The command, ftype, is used to define open command strings. The combination of the assoc and ftype commands manage associations. Typing ftype without options displays the file types that have defined open command strings. Enter ftype SoundRec to display the open command string for the file type SoundRec. Typing ftype SoundRec= will delete the open command string.

To define a new association for .log files that you want to open with Notepad, use the following syntax:

assoc .log=LogFile
ftype LogFile=%Systemroot%\System32\notepad.exe %1

You can use a combination of these command-line utilities in a batch file or to re-associate files across your network if you run it as a logon script. For more information, type ftype /? at the command prompt.

See Also

Featured Links