December 13, 2001

By Karen Kenworthy


That was as polite a snow storm as I ever hope to see. The last time we got together, it was snowing here at the secluded Power Tools workshop. By the time the sky cleared, 6-8 inches of the soft, white stuff laid on the ground.

But because the temperature hovered just below freezing, snow melted on the streets as quickly as it fell. It's as if every driveway, street and sidewalk shoveled itself!

New Directory Printer

The snow was still falling, and the bits of the last newsletter were scarcely dry, when suggestions for more Directory Printer enhancements started pouring in. Fortunately, all the suggestions were the same: teach the Directory Printer to sort by filename extension. :)

Most of us are very familiar with filename extensions. These are the last little bits of a file's name, the portion that follows a period ("."). For example, if a file's full name is "example.txt" its filename extension is "txt".

In olden days, when Windows limited file names to just 11 characters and a single period, a filename's extension could occupy no more than three of characters. But today, when file names can contain 255 characters, filename extensions can be as many as 253 characters long.

Today, a file's name can also have more than one period. When that's the case, the extension consists of just those characters that follow the last period in a file's name. For example, if a file's full name is:

its filename extension is "file".

Oh, and in case you're wondering, a file whose name contains no periods , or whose name ends with a period, has a filename extension of "" (an empty or zero-length string).

So now the Directory Printer can sort its lists of files by these little bits of text. But why are filename extensions important? And what secrets can the reveal?


Filename extensions are important because, through the magic of the Windows Registry, they tell Windows what program normally opens, creates and reads a particular file. For example, files whose names end with ".txt" are plain text files, normally accessed by Windows' text editing program known as Notepad.

Files with extensions of ".html" or ".htm" contain HyperText Markup Language statements, and are normally opened and displayed by web browsers. Other popular filename extensions include "wav" (digitized sound), "bmp" (bitmapped graphic image) and "tmp" (any sort of temporary data file).

Files, and the programs that normally access them, are said to be "associated." And, like so much nowadays, the details of these associations are stored in the Windows Registry. In particular, you'll find the associations between files and programs laid out in the HKEY_CLASSES_ROOT section of the Registry.

If you've spent much time exploring the Windows Registry, you've probably come across the HKEY_CLASSES_ROOT section. It's not only the Registry's first section, it's usually the largest. And it's where much of the arcane information that makes Windows work is stored.

Discovering the program associated with a particular file is a two step process. First, you must read the entry in HKEY_CLASSES_ROOT corresponding to the file's name extension. For example, to find the program associated with text files, you'd read this Registry key:


The value you'll find stored there is "txtfile." This little string is sometimes known as a file's type or class.

Next, we must read the Registry again. This time, the key we're after contains the file's class, retrieved a moment ago. In the case of text files (those with a filename extension of "txt" and a file class of "txtfile"), the Registry key we're after is:


Read from this Registry location, and you'll learn the command executed by Windows when you ask it to open a text file:

%SystemRoot%\system32\NOTEPAD.EXE %1

Pretty cool, eh? :)

I know, it looks a little weird. But don't worry. Windows replaces any text between percent signs ("%") with special values. For example, %SystemRoot% is replaced by the name of your \Windows\System directory. The "%1" at the end of this command is replaced too, by the name of the text file to be opened.

So, if Windows is asked to open a file named "letter.txt", it will run a command that looks something like this:

C:\Windows\System\NOTEPAD.EXE letter.txt

New Version Browser

If all this Registry spelunking and command substitution seems like a lot of work, you're right. But it's also a great opportunity to enhance an old Power Tool. The Version Browser program has long shown hard-to-find information about files. And displaying a file's association sounds like a task it ought to tackle.

And that's exactly what Version Browser v3.1 does. In addition to all the information it has always displayed (a file's author, version, intended Windows version, programmer's comments, and more), it now reveals the program associated with each file.

The Version Browser can display the information about a single file. Or it can print information about a single file, or all the files in a folder. It can even save information to disk, where it can be read by spreadsheets, word processors, and other applications.

If you'd like to try the new Version Browser, download a copy from the Version Browser's home page at:

And while you're in the neighborhood, drop by the Directory Printer's home page:

and download a copy of the new Directory Printer v3.2. You'll be printing lists of files, sorted by filename extension, in no time. As always, the programs, and their Visual Basic source code, are free.

Or better yet, visit my CD home page at:

There you can order your own copy of Karen's Power Tools CD! In addition to the latest version of very Power Tools, every CD contains two bonus Power Tools not available anywhere else, back issues of all my newsletters, and a special license that lets you use my Power Tools at work.

That's all from here for now. The weatherman's predicting another snowstorm in a couple of days, and this one may not mind its manners. But either way, I'll be safe and warm.

Hope you will be too, until we meet again. And in the days ahead, if you see me on the 'net or at the mall, be sure to wave and say Hi!

YouTube button
Downloads Today: 16
More than 6000 downloads monthly
Received $587.68 this month* — Thanks!

License for Work

A license is required to use any or all of these tools for your work. You only need one per lifetime. If you make money with Karen's software, read her license agreement.

License for Work $25

Donations + Other Ways

Power Tools Newsletter

November 1st, 2023:

  • What is Karen's QR Code Talker?
  • What is a QR code?
  • What is a Code Talker?

List of All Issues since '99

24812 Verified Subscribers

Subscribe to receive new issues of the newsletter about Karen and her free Power Tools.

Click here to Subscribe

April Revenue* $587.68
*Licenses + Donations - PayPal Fees
Mar $273 Feb $405 Jan $56 (2023) Dec $349 Nov $546 Oct $253 Sep $232 Aug $189 Jul $379 Jun $188 May $484 Apr $212 Mar $519 Feb $89 Jan $462 (2022) Dec $1088 Nov $151 Oct $133 USD — Thanks again!