General Guidelines for Supporting Long
Filenames
The following general guidelines for working with long
filenames apply to all file systems supported by the various
Windows systems. An application that follows these guidelines can
create valid names for files and directories regardless of the
file system in use.
- You can include any character from the current code page
in a name, but do not use a path separator, a character
in the ASCII range 0 through 31, or any character
disallowed by the specific file system. A name can
contain characters from the extended character set (ASCII
128 through 255).
- Use the backslash (\), the forward slash (/), or
both to separate components in a path.
- Use a period (.) to represent the current directory in a
path.
- Use two consecutive periods (..) to represent the parent
of the current directory in a path.
- Separate components in a directory name or in a filename
with a period (.).
- The following characters are reserved for Windows and
should not be used in directory names or filenames:
< > : " / \ |
- Do not use reserved words, such as aux, con,
and prn, as filenames or directory names.
- The application should process a path as a
null-terminated string. The maximum length for a path is
given by MAX_PATH. The Unicode versions of the
CreateDirectory, FindFirstFile, GetFileAttributes, and
SetFileAttributes functions allow paths to exceed the
MAX_PATH length if the path has the \\?\ or \\?\UNC\
prefix. These prefixes turn off path parsing. Use the
\\?\ prefix with paths for local storage devices and the
\\?\UNC\ prefix with paths having the Universal Naming
Convention (UNC) format. An example of a UNC path is \\machine\sharename.
- Do not assume case sensitivity, because not all file
systems distinguish case. For example, under NTFS, the
filenames FILENAME and Filename are considered to be the
names of two different files; under HPFS, however, these
two filenames are considered to be the same, although the
file system preserves the case as entered and allows the
user to see mixed-case filenames.