With the introduction of Windows NT and Windows 95, Microsoft has finally given PC users something that has been on available on other platforms for yearsthe ability to use long file names. Both Windows 95 and NT can support long file names on existing file allocation table (FAT) partitions, which can be an incredible plus for anyone who works on these platforms. Files are no longer limited to an eight-character name followed by a three- character extension (8.3). Instead of using cryptic names such as 1QSLREG1.XLS, PC users can give files meaningful names such as First Quarter Sales Report by Region (Version 1).XLS. However, in the mixed environments found in most MIS departments today, long file names can create almost as many new problems as they solve. Knowing the rules for using long file names can prevent many of the headaches they might cause, while still allowing users to fully benefit from this new technology.
Considerations When Creating Long File Names
Long file names are available only on Windows 95 and NT, which can cause difficulties in MIS departments where Windows 3.1 PCs are also used and in companies that are incrementally upgrading their PCs. Further complicating the issue is the fact that each operating system supports long file names on different file systems. As shown in Figure 1, Windows 95 only supports it on the FAT file system, while Windows NT can support long file names on FAT, High Performance File System (HPFS), or New Technology File System (NTFS), each of which has slightly different rules governing the length of names and the characters allowed. In the event that a mixed environment is not acceptable, both Windows 95 and NT can be forced into using the Windows 3.1 version of FAT. Changing the Registry Key
HKEY_LOCAL_MACHINESystem CurrentControlSetControl
FileSystemWin31FileSystem
to 1 will enable the older FAT system and will disable long file name support.
Those people who decide to keep long file name support will need to understand the rules for creating a long file name. Any file or directory may be given a long name, although care must be given to not to exceed the limitations on the number and type of characters allowed. There are several rules for creating a long file name.
On FAT partitions, all numbers and characters are allowed, including spaces and excluding these characters: ? / [ ] * | : ; = ^ ,
On NTFS and HPFS partitions, all numbers and characters are allowed, including spaces and excluding these characters: ? / < > * | :
Multiple periods are allowed in the name, with the extension being the characters after the last period.
On FAT and NTFS partitions, long file names or directory names can be up to 255 characters.
On HPFS partitions, long file names can be up to 254 characters.
All partition types will maintain the case of the long file name, but none of them are case-sensitive. For example, moving a file called Current Readme.txt to a directory will overwrite the CURRENT README.TXT already in that directory, but now it will appear as Current Readme.txt in the directory listing.
Even if you follow all the rules in creating long file names, they can still cause problems when used on a FAT partition. The FAT file system was originally designed to store each 8.3 file name in a separate directory entry. Now it must contend with up to 255 characters per file name, plus an automatically generated 8.3 alias for the same file. (I will go into that caveat more later.) FAT handles this problem by using one directory entry for every thirteen characters of the long file name and an additional entry for the 8.3 alias. For example, a file called Memo to Bank Regarding Account.doc would use three directory entries for the long file name and one more for its alias. This can be critical in the root directory, which has a hardcoded limit of 512 directory entries. The moral here is to keep your root directory free of extraneous files, especially those with long file names. Long file names can also cause a problem for older disk utilities, many of which will report the extra directory entries as lost or corrupt files. Be sure to only use disk utilities designed for Windows 95 or Windows NT in order to prevent these problems.
Backwards Compatibility for Applications: The 8.3 Alias
Are Windows 3.1 and DOS users and applications prevented from using files with long file names? Microsoft obviously has a large stake in maintaining backwards compatibility with its previous operating systems and the applications created for them, and has taken steps to ensure that the new long file names can be used from these older platforms. Both Windows 95 and Windows NT generate an 8.3-compatible alias for a long file name, using a standard algorithm. Under this scheme, the first six digits of a long file name are retained, excluding any spaces, extra periods, and illegal characters. After this, the algorithm places a tilde (~) and the number one (1), followed by the original extension truncated to three digits. Finally, the name is converted to uppercase letters. The same procedure is used for the next three files in the same directory that have the same first six digits in their names, except that the number is incremented for each file, as seen in Figure
2. With the fifth similar file name, the alias algorithm retains only the first two characters of the original long file name, and appends four randomly generated characters, followed by the tilde and the number five. All additional files will have four different middle characters. When one of the random generations finally duplicates an existing file name,
the number after the tilde will be incremented again, and so on. However, at this point it would probably be advisable to come up with a new naming scheme.
Typing in the DIR command from a Windows 95 command prompt will display both the long file name and its automatically generated counterpart. From a Windows NT 3.51 or 4.0 command prompt, it is necessary to enter DIR /X to see the same information. If you are working on a Windows NT machine with NTFS partitions and are in an environment where all computers and applications can support long file names, it is possible to disable the alias algorithm. Changing the Registry Key
HKEY_LOCAL_MACHINE
SystemCurrentControlSet
ControlFileSystemNtfs
Disable8dot3NameCreation
to 1 will stop the generation of aliases. Most IS departments still support mixed platforms, including both Windows 3.1 and Windows NT or 95. In addition, there always seems to be that one legacy DOS application that the business must have to survive. Whatever the reason, eventually you will most likely have to use an older application to open a file with a long file name. Knowing how Windows creates an alias for each file is a start, but it also helps to know how older applications and partitions will behave when faced with a long file name.
Sixteen-bit applications will always use the 8.3 alias when working with files. This is the name that will be displayed in all dialog boxes and messages. Any long directory names will also appear in their shortened version. If a 16-bit application opens an existing file with a long file name and saves it with the same name, the existing long file name will be preserved on the network drive. However, if the file is to be saved in a new location or if a new file is created, it will only have an 8.3 name. Of course, the easiest solution is to upgrade all applications to the latest 32-bit versions, which have native long file name support, although this will not make you very popular with the accounting department.
The Windows 95 and NT command prompts also require some special treatment of long file names, especially when copying files to older computers. Any commands typed in at the Windows 95 or NT command prompts will require that the long file names be entered in quotes, or that the alias be used in the command. For example, Figure 3 shows the correct syntax for two commands that will have the same result. When using COPY or XCOPY to transfer files to a FAT partition that doesnt support long file names, the /N switch will copy the files using the generated short names. It is important to note that this same command will not work when copying from an HPFS partition to an older FAT partition, as HPFS does not generate the short file name alias.
Long file names finally enable computers to name objects in the same manner that people have for years. In spite of the potential pitfalls, the additional clarity of the long names makes them worthwhile. If you happen to work in a mixed environment, you can use short names or aliases for those files that must be used by systems that cant handle a long file name, while still using the longer names on systems that support them. Long file names can be addictive, though. Once you become used to working with long file names, you wont want to go back to the world of 8 dot 3.
References
Support Fundamentals for Microsoft Windows NT, Microsoft Press, 1995 Windows NT Resource Kit, Microsoft Press, 1995
Figure 1: Operating System Support for Long File Names Figure 2: Long File Names and Their Aliases Figure 3: Using Long File Names from a Command Prompt
LATEST COMMENTS
MC Press Online