Information about long file names

Updated: 12/09/2018 by Computer Hope

Screenshot: A long file name, and a short file name, listed in the Windows command prompt with the dir command.long file names are a feature of modern file systems, but they were not supported by early versions of Microsoft Windows and MS-DOS. As a computer user, there are special ways you can work with long file names, and a few pitfalls and tricky cases to watch out for. Continue reading to learn more about how to use long file names on your computer.

Why long file names are useful

Long file names are great for the user because they allow for descriptive and specific file names. For example, if you have a digital photo that you copied from your camera to your computer, you can rename the cryptic name to something more descriptive:

Billy's fifth birthday, right when he was blowing out the candles.jpg

Your operating system knows how to handle that name, including punctuation, spaces, and capital letters.

Early versions of Windows, MS-DOS, and FAT

However, early versions of Microsoft operating systems such as MS-DOS or Windows 3.x did not support long file names. They used FAT, a file system that limits file names to eight characters and a three-character file name extension. FAT file names were also case-insensitive, meaning that it did not distinguish between uppercase and lowercase letters. This FAT file naming convention was commonly known as the 8.3 format.

If you were using one of these operating systems, you would have to rename your photo to something like this:

BILLY5BD.JPG

Windows 95 and VFAT

Windows finally added long file name support in Windows 95, joining other operating systems like Unix, OS/2, and macOS that already included long file name support.

Released in August 1995, Windows 95 featured a new version of FAT, called VFAT, that supported file names with a maximum length of 255 characters. All of this was accomplished without losing backward compatibility with existing DOS volumes. Due to backward compatibility, long file names, if present, are converted by VFAT to the original 8.3 character file naming convention by each file going through the following changes.

  1. The extended characters + , ; = [ and ] are converted to underscores ( _ ).
  2. The first three characters after a period become the extension.
  3. Spaces are ignored.
  4. The first six characters now remaining are converted to uppercase.
  5. The last two characters after the first six become "~1". If another file exists with the same first six characters and ~1, the file name will be converted to "~2"; this process will continue. In the event you have more than nine files with the same first nine characters, the tenth file becomes ~10, using the last three characters.

To access a long file name or directory such as "my long file name or directory," a user would need to use its MS-DOS short name, for example:

mylong~1

The LFNBK utility

Windows 95 and 98 installation media included a long file name backup utility called LFNBK. Variations of the utility were distributed in executables including LFNBK.EXE, DOSLFNBK.EXE, and SULFNBK.EXE. These internal Windows utilities were used to back up or restore information about long file names. These utilities should be used with care because they can permanently alter your file system. For instance, running LFNBK /A /B C: may strip long file names from the VFAT volume on drive C:, and store them in a text file called LFNBK.DAT. The long file names could be restored at a later time by running the command LFNBK /R.

Reserved characters

Long file names in Windows may contain any printable character, except for the following reserved characters:

/ \ : * ? " < > |

Windows NT, 2000, and XP

Unlike earlier versions of Windows, users can access the Windows command line using CMD instead of the COMMAND command. If you open the command line from Run type CMD instead of COMMAND and you can use the full long file name instead of the short 8.3 format name.

Windows 95, 98, and ME

Accessing long file names can change depending on how you have entered MS-DOS. If you are in an MS-DOS window (MS-DOS shell aka Windows command line), you can access the long file name by typing the complete long file name. If the file contains spaces or the file name or directory is longer than eight characters, place quotes around the long file name as shown below.

cd "program files"

If you have exited Windows to an MS-DOS prompt or booted from a bootable diskette, you need to use the short file naming convention. For example, if the directory you were trying to get into is "Program Files" you would need to type:

cd progra~1

Note: In later versions of Microsoft Windows (such as Microsoft Windows 2000 or Windows XP), some commands in the shell can contain spaces without being enclosed in quotes.

Long names with spaces

To access a long file or directory name that contains spaces, place the name of the directory or file name in double quotes. An example of how to get into the program files directory would look like:

cd "program files"

Long directory names

If you were attempting to access the directory "Microsoft Office" in the "Program Files" directory, you could type:

cd "program files\microsoft office"

or

cd "c:\program files\microsoft office"

Long file names that save incorrectly as 8.3 names

If you try to save a file with a long file name, but it is truncated to a short 8.3 format file name, the software you are using may not support VFAT. If possible, contact the developer or vendor of the software program for an official solution. If none is available, you may be limited to short file names when using that software.

Long names that get shortened in a Windows command prompt

If the computer is booted into a command prompt, or you use a Windows 98 startup diskette and use long file names, your files will be overwritten. This problem is a known issue with Microsoft Windows 98, and it's recommended when in MS-DOS not to use long file names and instead use the conventional 8.3 file format names.

Additional information