Extensions help Windows understand what to do with a file. Extensions tell Windows what program to use to open a file or what action to perform when a file is double-clicked. Some files, e.g. exe files, are full-fledged programs that don’t need any help from Windows to run (in a simplified manner of speaking). Other files cannot do anything by themselves, they need an application that can open them and make them useful. To open graphics files, you need software that can open that type of image file. To open text files, you need software that is capable of word processing.
Let’s take text files for example. Go to Start/Find/Files or Folder, type *.txt, select Local hard drives and click Find Now. You should get a long list of text files that are on your hard drive. Pick a text file from the list and double-click on it. Most likely an application called Notepad will pop up on your screen and display the text that is contained in the text file you selected. But how did Windows know how to do this?
The clue is, as with everything that Windows does, in the Windows registry, the heart and soul of Windows. This is the place where Windows stores a list of file types it knows, what these files do, and what to do with them when one is selected. Thankfully we don’t have to hack around in the registry to take a closer look at this list and to modify it. There is a relatively simple interface for that. Open Windows Explorer, go to View/(Folder) Options, and select the File Types tab. Here you’ll see a long list of registered file types that you can scroll through. Take a moment and browse through this list. You’ll probably see all the file types I mentioned earlier and a whole lot more.
For our example, let’s scroll down to the T’s and find the listing for txt. Click on it once and observe the details displayed below. You’ll see that Windows indicates that the extension for this type of file is txt and it opens with Notepad. Now we know why Windows automatically opened Notepad. When you double-clicked the file earlier, Windows looked at the extension, compared it against its list of registered file types, found it, and followed the instructions and opened it with Notepad.
How did this list come into existence? Windows knows right out of the box how to recognize a bunch of different file types. In addition, every time you install a new piece of software that uses a certain type of file, during the installation of this program the required entries are made into this list. This process is called registering a file type.
But there’s more. There are more options than just to open a file. If you right-click on a text file in Explorer, you’ll notice that the top two items on the context menu are Open and Print. OPen is highlighted because it is the default action to perform for this file type. Print is an additional option and easily accessible via this convenient shortcut in the context menu. Instead of having to open the file with its associated application and going to File/Print, just right-click and select Print. Very easy.
Now your next thought is probably “Cool! And how can I add my own custom options to this right-click menu, or change the existing option?” You’ll be surprised how easy this is. Open Windows Explorer, go to View/(Folder) Options, and select the File Types tab. Scroll down to txt, highlight it and click Edit, or just double-click it. Up pops a windows that lets you edit this file type. If you look in the Actions field, you’ll notice two options listed: Open, which is bold indicating it is the default option, and Print as a secondary action. In this dialog you can also change the default option in the right-click menu by highlighting an action other than the current default action and pressing Set Default.
Let’s say you wanted to have another option of easily editing a text document with Word. Click New and you’ll get a dialog box where you can create your own action. First type in a name for the new action, but try to keep it short, otherwise the context menu gets too wide. Type Edit with Word. The field below is where you specify the path to the application that will be used for this action. Click the Browse button and navigate to C:\Program Files\Microsoft Office\Office\WinWord.Exe (or wherever Word is installed on your PC) and double-click WinWord.Exe. That will put the path into the application field. That’s it, you’re done. Just keep clicking OK/Close until you’re back to the Explorer window. Now find a text file, right-click on it and you should see your new action. Click it and the text file opens in Word instead of Notepad.