August 30, 2013

The Miracle of File Association

Filed under: Main — Tags: , — admin @ 12:01 am

You don’t even think about it. Click on a file icon and a program opens. Well, hopefully it opens. When it does, the process is called file association. It’s how all graphical operating systems know which files belong to which programs. It’s a process that makes your computing world a more sane place.

Yeah, you may not think of the computer as having any relationship to sanity whatsoever. To drive home my point, visit with me the dark ages of the command line. The Land Before Windows. The Days of DOS.

Like your computer now, a DOS computer had applications and documents. But if you wanted to edit a document named REPORT.DOC you didn’t just type the name REPORT.DOC at the command prompt. If you did, you’d see the error message:

Bad Command or Filename

That’s not very helpful, yet it explains why I sold a few million copies of DOS For Dummies.

No, to open the document you needed to type the name of the program that created the document. Yep, you had to keep all that in your head. If you remembered, then you could type this command to run the program that created the document and open the document for editing:

WP REPORT.DOC

Again, you can see how people clamored for a book that explained such things in plain language.

Today, you just double-click an icon and off you go. Windows automatically knows which documents belong to which programs. You don’t even think about it. But nerds like me think about it, so I’ll spend today’s blog post explaining a bit how it works and why it may cause you some confusion from time to time.

File association is the art (because it’s not a science) whereby certain types of files are associated with certain programs. In the case of a REPORT.DOC file, Windows looks to the filename extension for a clue. The filename extension in this case is .DOC, which pronounced dot-dock.

You may not see the .DOC part of the filename, but it’s there. Windows hides the extensions of known file types, which prevents some users from messing with them.

When you try to open a .DOC file, Windows looks into its registry to see which program is associated with a .DOC file. Most of the time, it discovers that Microsoft Word claims ownership of all .DOC files. In that case, Windows fires up a copy of the Word program and passes off the .DOC file to that program for editing. Hopefully everything goes correctly.

The association also helps Windows assign icons to the file. For Word, the icon of a .DOC file looks like a Word document icon. Now if the same file were associated with another program, it would carry that program’s icon. In fact, in Figure 1 you see two icons representing the same .DOC file, one for Word 2010 and the other for Word 2013. It’s the same file, but shown by two different icons.

Figure 1. The same document file represented by two different icons.

Figure 1. The same document file represented by two different icons.

Again, the icon type, as well as the program that opens the icon, is all part of file association. It’s a good thing, with a good purpose. Don’t let it confuse you!

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.


Powered by WordPress