Using Long File Names

File names on Windows NT and Windows 2000 platforms can be up to 255 characters, and can contain spaces, multiple periods, and special characters that are forbidden in MS-DOS file names. Windows 2000 makes it possible for other operating systems to access files with long names by automatically generating an MS-DOS-readable (8.3) name for each file. Files are accessible over a network by computers using MS-DOS and Windows 3.x, as well as by computers using Windows 95, Windows 98, Windows NT, and Windows 2000 operating systems.

By creating 8.3 file names for files, Windows 2000 also enables MS-DOS-based and Windows 3.x–based applications to recognize and load files that have long file names. In addition, when an application saves a file on a computer running Windows 2000, both the 8.3 file name and long file name are retained.

If the long name of a file or folder contains spaces, you must surround the name with quotation marks. For example, if you have a program called Dump Disk Files that you want to run from the command line and you enter the name without quotation marks, it generates the error message "Cannot find the program Dump or one of its components."

You must also use quotation marks when a path typed at the command line includes spaces, as in the following example:

move "c:\This month's reports\*.*" "c:\Last month's reports"


Use wildcard characters such as the asterisk (*) and question mark (?) carefully in conjunction with the del and copy command-line commands. Windows 2000 searches both long and short file names for matches to the wildcard character combination you specify, which can cause additional files to be deleted or copied.

Both FAT and NTFS use the Unicode character set for their names, which contain several forbidden characters that MS-DOS cannot read in any file name. To generate a short MS-DOS-readable file name for a file, Windows 2000 deletes all of these characters from the long file name and removes any spaces. Because an MS-DOS-readable file name can have only one period, Windows 2000 also removes all extra periods from the file name. Next, Windows 2000 truncates the file name, if necessary, to six characters and appends a tilde (~) and a number. For example, each nonduplicate file name is appended with ~1. Duplicate file names end with ~2, then ~3, and so on. After the file names are truncated, the file name extensions are truncated to three or fewer characters. Finally, when displaying file names at the command line, Windows 2000 translates all characters in the file name and extension to uppercase.


note-icon

Note

You can permit extended characters by setting the value of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
\NtfsAllowExtendedCharacterIn8dot3Name to 1.

When there are five or more files that would result in duplicate short file names, Windows 2000 uses a slightly different method for creating short file names. For the fifth and subsequent files, Windows 2000:

  • Uses only the first two letters of the long file name.
  • Generates the next four letters of the short file name by mathematically manipulating the remaining letters of the long file name.
  • Appends ~1 (or another number, if necessary, to avoid a duplicate file name) to the result.

This method provides substantially improved performance when Windows 2000 must create short file names for a large number of files with similar long file names. Windows 2000 uses this method to create short file names for both FAT and NTFS files.

Table 3.7 shows the short file names for files that were created in the order test 1 through test 6.

Table 3.7 Short File Names Created by Windows 2000 Example One

Long File Name Short File Name
This is test 1.txt THISIS~1.TXT
This is test 2.txt THISIS~2.TXT
This is test 3.txt THISIS~3.TXT
This is test 4.txt THISIS~4.TXT
This is test 5.txt TH0FF9~1.TXT
This is test 6.txt THFEF5~1.TXT

If the long file names in Table 3.7 are created in a different order, their short file names are different, as shown in Table 3.8.

Table 3.8 Short File Names Created by Windows 2000 Example Two

Long File Name Short File Name
This is test 2.txt THISIS~1.TXT
This is test 3.txt THISIS~2.TXT
This is test 1.txt THISIS~3.TXT
This is test 4.txt THISIS~4.TXT
This is test 5.txt TH0FF9~1.TXT
This is test 6.txt THFEF5~1.TXT

To see both the long and short file names for each file in the folder, type the following on the command line:

dir /x

© 1985-2000 Microsoft Corporation. All rights reserved.



Microsoft Corporation Staff, IT Professional Staff - Microsoft Windows 2000 Server Operations Guide
Microsoft Corporation Staff, IT Professional Staff - Microsoft Windows 2000 Server Operations Guide
ISBN: N/A
EAN: N/A
Year: 2002
Pages: 404

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net