Windows Path Syntax

In general, a Windows pathname consists of an optional drive specifier and a drive-specific path. As noted in section 11.3, a Windows path can be absolute but still relative to the current drive; such paths start with a forward slash or backslash separator and are not UNC paths or paths that start with \\?\.

A path that starts with a drive specification is complete. Roughly, a drive specification is either a Roman letter followed by a colon, a UNC path of the form \\machine\volume, or a \\?\ form followed by something other than REL\element. (Variants of \\?\ paths are described further below.)

MzScheme fails to implement the usual Windows path syntax in one way. Outside of MzScheme, a pathname C:rant.txt can be a drive-specific relative path. That is, it names a file rant.txt on drive C:, but the complete path to the file is determined by the current working directory for drive C:. MzScheme does not support drive-specific working directories (only a working directory across all drives, as reflected by the current-directory parameter; see section Consequently, MzScheme implicitly converts a path like C:rant.txt into C:\rant.txt. More generally,

Otherwise, MzScheme follows standard Windows path conventions, and MzScheme adds a \\?\REL convention plus conventions to deal with excessive backslashes in \\?\ paths. In the following, letter stands for a Roman letter (case does not matter), machine stands for any sequence of characters that does not include backslashes or forward slashes and is not ?, volume stands for any sequence of characters that does not include backslashes or forward slashes, and element stands for any sequence of characters that does not include backslashes.

Three additional MzScheme-specific rules provide meanings to character sequences that are otherwise ill-formed as Windows paths:

Outside of MzScheme, except for \\?\ paths, pathnames are typically limited to 259 characters. MzScheme internally converts pathnames to \\?\ form as needed to avoid this limit. The operating system cannot access files through \\?\ paths that are longer than 32,000 characters or so.

Where the above descriptions says ``character,'' substitute ``byte'' for interpreting byte strings as paths. The encoding of Windows paths into bytes preserves ASCII characters, and all special characters mentioned above are ASCII, so all of the rules are the same.

Beware that the backslash path separator is an escape character in MzScheme strings. Thus, the path \\?\REL\..\\.. as a string must be written "\\\\?\\REL\\..\\\\..".