Long file name
Sometimes abbreviated as LFN, a long file name is a computer file name that allows for a liberal number of characters. With LFN, users can give elaborate, descriptive names to their files and directories. LFN was widely introduced to consumers with the release of Microsoft Windows 95, as an upgrade to the case-insensitive 8.3 naming format of Windows 3 and MS-DOS. Before Windows 95 long file names were only 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 copied a digital photo 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:
Windows 95 and VFAT
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 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.
- The extended characters + , ; = [ and ] are converted to underscores ( _ ).
- The first three characters after a period become the extension.
- Spaces are ignored.
- The first six characters now remaining are converted to uppercase.
- 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 is converted to "~2." This process continues for all files in a directory. 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 needs to use its MS-DOS short name. An example is shown below.
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.
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 type the following command.
In later versions of Microsoft Windows (e.g., Microsoft Windows 2000 or Windows XP), some commands in the shell can contain spaces without being enclosed in quotes.
Long file names with spaces
To access a long file or directory name containing 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"
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 use 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 are overwritten. This problem is a known issue with Microsoft Windows 98, and we recommend when in MS-DOS not to use long file names and instead use the conventional 8.3 file format names.