Home > Articles

  • Print
  • + Share This

Working with Long Filenames

Windows enables you to create names for files and folders using up to 255 characters. Legal filenames can contain spaces and most special characters, including periods, commas, semicolons, parentheses, brackets ([ ]), and dollar signs. However, you are not allowed to use the following characters when naming a file or folder:


How Windows Generates Short Filenames

Like earlier Windows versions, Windows Me maintains backward-compatibility with older operating systems and applications; for compatibility's sake, the file system automatically generates short filenames from long names you create. Although this process occurs in the background, it's important to understand the rules.

When you save a file using Windows or a 32-bit Windows application, Windows checks the filename you enter. If the name is a legal MS-DOS name (with no spaces or other forbidden characters), has no more than eight characters in the name, and has no more than three characters in the extension, the short filename is the same as the long filename. If the long filename contains spaces or other illegal characters or is longer than eight characters, Windows performs the following actions to create a short filename:

  1. Removes all spaces and other characters that are not allowed in MS-DOS compatible filenames, as well as all periods except the rightmost one.

  2. Truncates the long filename to six characters, if necessary, and appends a tilde (~) followed by a single-digit number. If this procedure duplicates an existing filename, Windows increases the number by one: ~1, ~2, ~3, and so on. If necessary, it truncates the long filename to five characters, followed by a tilde and a two-digit numeric tail.

  3. Truncates the file extension to the first three characters. If the long filename does not include a period, the short filename will have no extension.

  4. Changes all lowercase letters to capital letters.


Several books and computer magazines have published details for adjusting a Registry setting (NameNumericTail) that controls the way in which Windows automatically generates short filenames from the long filenames you create. Do not make such changes! The result can seriously affect the operation of some Windows accessories that depend on the Program Files folder. For more information on this topic, go to support.microsoft.com/search/default.asp and search for Knowledge Base article Q148594.

You cannot change the automatically generated short filename, nor can you view this name from an Explorer window. To see the MS-DOS—compatible name for any file, you must open an MS-DOS Prompt window and use the DIR command.

Using Long Filenames with Older Windows Programs

If you use 16-bit Windows programs, long filenames are not available in common dialog boxes such as File Open and File Save As. Instead, you'll see the truncated short version of all filenames (see Figure 3.23).

Figure 3.23 When you view files using 16-bit Windows programs, you see only the short filenames, not their long equivalents.

Through a process called tunneling, Windows enables you to preserve long filenames even when you use older programs to edit the files. If you create a file and give it a long name using Windows or a 32-bit Windows program, and you then edit the file using a 16-bit program and save it to a short filename, Windows preserves the long filename. Be careful, however–make sure you're working with the correct file before making any irretrievable changes!


  • + Share This
  • 🔖 Save To Your Account

Related Resources

There are currently no related titles. Please check back later.