3.2 Names and Paths

Each drive, file, and directory has a name. Drive names consist of a single letter (A through Z) followed by a colon (:). File and directory names can have up to eight characters, optionally followed by a period (.) and an extension of up to three characters.

Names and extensions can contain letters, digits, and any of the characters in the following set:

! # $ % ^ & ( ) - _ { } ~

MS-DOS does not distinguish between uppercase and lowercase letters in filenames and extensions. In other words, the filenames abc and ABC are the same. Although extended ASCII characters (characters with values greater than 127) are also permitted in names, programs should avoid them, since the meanings of the extended characters may differ with different code pages. If a program requires extended characters in names (for example, to spell foreign-language names accurately), the program should use code page 850 to generate the names.

Functions that search for files by pattern accept wildcards in filenames. The MS-DOS wildcards are the asterisk (*) and the question mark (?). The asterisk matches any combination of characters in a name, and the question mark matches any single character.

A path is a combination of a drive name and a directory name that together uniquely specify a directory, or a combination of a drive name, a directory name, and a filename that together uniquely specify a file. The following are valid paths:

a:\sample\abc.txt ;full path specifying a file

a:\sample ;full path specifying a directory

\sample\abc.txt ;partial path, assumes current drive

a:abc.txt ;partial path, assumes current directory

abc.txt ;partial path, assumes current drive and directory

..\abc.txt ;partial path, relative to the parent directory

Programs use full paths to make an unambiguous reference to a file, and partial paths to let the system construct a full path based on the current drive, the current directory, or both. A path, excluding drive name, must not exceed 64 characters. This rule also applies to full paths that MS-DOS constructs from partial paths.

A network name identifies a resource, such as a drive, file, or device, that is available to a program when network software is installed. The name consists of at least a computer name and a share name; it may also include a path. The computer name uniquely identifies the network server owning the resource, and the share name identifies the resource. If a path is given, it uniquely identifies a directory or file on a network drive.

Network names have the following forms:

\\server1\datafiles ;network drive

\\computer2\laser ;network printer

\\server1\datafiles\readme.txt ;file on network drive

\\server1\datafiles\log\june91.txt ;file in path on network drive

Programs use network drive and printer names to connect to network resources; they use network filenames to open or create files or directories on network drives.