Copyright 2020 Mike Strong,

Working With Files and the File Extension Problem

When editing in Notepad and when opening files you need to know what kind of file you are saving or what kind of file you are looking at. In the "old" days every computer user had a good knowledge of what file extensions went with what kind of files. It was the way the computer could determine which program to use to open a file with. For example a "DBF" extension was a database file from dBase or dBManager or Foxbase and so forth. Clicking on a DBF file would bring up dBase or whatever other program you used which could read and use a DBF file.

A "TXT" extension was and is a text file and clicking on that would (does) bring up your text editor, such as EDIT in the old days or Notepad in Windows. A "COM" or an "EXE" was a program file ("com" stood for command file, "exe" stands for executable file - programs are just a series of commands which are executed). Clicking in this starts that particular program.

When Windows 95 came out the programmers who created it also tried to relieve the need to know all those extensions by hiding the extension and substituting their own short description of the file type in a separate directory column. Not the worst idea, and you can understand the reasoning, but a dumb set of results which we have been living with ever since with no sign of a worthwhile change.

This problem leads to people in the database class not being able to open their downloaded change-the-name database file in Access (come up in Notepad) and it leads to people editing webpages in Notepad saving what they think are files with names like "MyPage.htm" which are really "MyPage.htm.txt" making the files un-open-able as web pages.

The period (.) character (dot) is legal within a file name meaning that it is easy to have multiple "dots" in the name including at the end the the filename creating more than one filename extension. This "feature" can be used, in combination the "Hide Extension" setting, to hide malicious software.

This is so easy to correct that it seems a crime that the correction has not been the default. It is all too easy to start up a virus or other malware by clicking on a program which, from its humble "txt" extension looks like a text file. But the real (last) extension may well be "exe" for a program (executable) file.

In the illustration below I added three dummy files just to have filenames showing what they are. Those are the filenames starting with "Example..." in the illustration.

In the illustration above the "Hide File Extensions" option is checked.

In the illustration below the "Hide File Extensions" option is UN-checked. The difference should be obvious.

In the illustration we can see first of all that we get more information. And with that information we can identify several possible problems.

  1. When saving documents in Notepad the program tries to save everything with the file extension "TXT" even when we deliberate type in another file extension such as ".htm" This is it's own hidden problem but it can be tackled if, every time you save (first save or "save as") your document you make sure that the file type is set to "*.*"

  2. If you are a database student this is an easy problem to have and not recognize. Some browsers and some email programs will not let you save or download a file with the "mdb" (Microsoft DataBase) for security reasons. Databases are programs which can have embedded macros which can do "things" on your disk. So, to get around that, we can simply have a version of the "mdb" file with a file extension of "txt" That will get through the file-type security filters. However, the person who downloads the file must then rename the file on their own end so that it has the proper extension. If you can't see the "txt" and double click on the file, the computer "thinking" it has a text file, will open it with Notepad instead of opening MS Access.

  3. Our third example was given a name to show how this hidden extension "feature" can be dangerous to your computer. You could well have a file with a name like "BigBadVirus.txt.exe" and if you are hiding file extensions all you would see would be "BigBadVirus.txt" which you might think is a text file with information about some virus. Clicking on this, instead of bringing up an innocuous text file will start executing and that could be harmful.

Steps to Solve the Problem and View Those Extensions

  1. On your own machine you will only have to do this one time and the setting will stick
  2. On campus you will have to repeat this each time you login because each machine is reset to defaults when anyone logs out


From Windows Explorer (the File Manager for Windows machines) you need to start with the Organize button


Click the button to get a pull-down menu


Then Click the "Folder and search options" option on the menu


This pulls up the "Folder Options" dialog. Note that in this example, "Hide extension for known file types" is Checked which means that filename extensions are being hidden.

Un-check (again UN-check) the "Hide extensions" because you do not want those filename extension hidden.

Now you can see all the information.


Tips for saving files in Notepad

By default Notepad tries to save any document with a file extension of "txt" even when you type in another extension such as in the "htm" example above

Notepad is liable to save the filename as "zzWebPage.htm.txt" rather than the "zzWebPage.htm" you intended. If you have "Hide Extensions" checked you won't see that and will think you've properly saved the file.
(NOTE: This is not consistent behavior on the part of Notepad across all versions of Windows. You may very well get exactly the filename and extension you typed in, as you should, unlike the problem illustrated here.)

To change that the "Save as type" pulldown give you the two choices of '*.txt" and anything else "*.*"

Choose the "All Files (*.*)" and click "Save"

That will give you a file with the extension you typed in.