Uniform Naming Convention[edit source | editbeta]
The Microsoft Windows UNC, short for Universal Naming Convention or Uniform Naming Convention, specifies a common syntax to describe the location of a network resource, such as a shared file, directory, or printer. The UNC syntax for Windows systems has the generic form:
\\ComputerName\SharedFolder\Resource
Microsoft often refers to this as a "network path".
Some Microsoft Windows interfaces also allow or require UNC syntax for WebDAV share access, rather than a URL. The UNC syntax is extended[2] with optional components to denote use of SSL and TCP/IP port number, a WebDAV URL of http[s]://HostName[:Port]/SharedFolder/Resource becomes
\\HostName[@SSL][@Port]\SharedFolder\Resource
Note: The UNC syntax sometimes appears written with slashes. Microsoft Windows treats slashes and back slashes in this context as equivalent (mostly).
When viewed remotely, the "SharedFolder" may have a name different from what a program on the server sees when opening "\SharedFolder". Instead, the SharedFolder name consists of an arbitrary name assigned to the folder when defining its "sharing".
Some Microsoft Windows interfaces also accept the "Long UNC":
\\?\UNC\ComputerName\SharedFolder\Resource
Microsoft Windows uses the following types of paths:
local file system (LFS), such as C:\File
uniform naming convention (UNC), such as \\Server\Volume\File or /<internet resource name>[\Directory name] (at least in Windows 7 and later)
long UNC or UNCW, such as \\?\C:\File or \\?\UNC\Server\Volume\File
In versions of Windows prior to Windows XP, only the APIs that accept "Long UNC" could accept more than 260 characters.
The shell in Windows XP and Windows Vista, explorer.exe, allows path names up to 248 characters long.
Since UNCs start with two backslashes, and the backslash is also used for string escaping and in regular expressions, this can result in extreme cases of leaning toothpick syndrome: an escaped string for a regular expression matching a UNC begins with 8 backslashes – \\\\\\\\ – because the string and regular expression both requires escaping. This can simplified by using raw strings, as in C#: @"\\\\".
Bookmarks