[Review] What Is UNC Path and How to Use It? [MiniTool Wiki]
What Is UNC Path?
A UNC path can be used to access network folders, files, etc. resources. It must be in the format specified by the Universal Naming Convention (UNC), which is the naming system applied in Microsoft Windows.
UNC path is a standard to identify servers, printers, and other resources within a network, which originated in the Unix community. It makes use of double slashes or backslashes to precede the name of the computer in Windows. The paths (disks and directories) within the computer are separated with a single slash or backslash (\).
On the contrary, in Unix systems including Unix and Linux-related OSes like macOS and Android, they use forward slashes (/) instead of backslashes.
What’s the difference between backslash & forward slash? Are they the same in grammar, file path, keyboard, etc.? what’s their function in different systems?
Valid UNC Path
A valid UNC path must include at least 2 path components of the 3, <servername>, <share>, and <filename>, which are referred to as the first pathname component, the second pathname component, and the third pathname component respectively. The last component of the path is also referred to as the leaf component.
The server-name consists of either a network name string set by an admin and maintained by a network naming service such as DNS or WINS, or by an IP address. Normally, those hostnames refer to either a Windows PC or a Windows-compatible printer.
The share-name section indicates a label created by an administrator or sometimes within the OS. In most Windows systems, the built-in share name admin$ refers to the root directory of the OS installation, usually C:\Windows but sometimes C:\\WINDOWS.
However, UNC paths don’t contain driver letters, only a label that may reference a particular drive.
Within a UNC path, the filename refers to a local subdirectory beneath the share section. This portion is optional. When file name is specified, the UNC path simply points to the top-level folder of the share. Besides, file_path must be absolute/fully qualified instead of relative. You can use relative paths only by mapping a UNC path to a drive letter.
The size and valid characters for a path component are defined by the protocol used to access the resource and the type of resource being accessed. The only restriction placed on path components by DFS is that path components must be one or more characters in length and mustn’t contain a backslash or a null.
UNC Path Examples
For Unix: //servername/path
For Windows/DOS: \\servername\path
How to Find UNC Path?
How to find the UNC path of a mapped network drive? Just run net use in CMD or PowerShell.
How to Create a UNC Path?
You are able to create a UNC path in Windows Explorer. Simply, right-click a folder and select one of the Share menu options to assign it a share name.
UNC Path vs Mapped Drive
A mapped network drive can be an alternative to a UNC path and both of them can be used in Microsoft Windows Explorer, Command Prompt, or PowerShell. With proper security credentials, you can map network drives and access folders on a remote PC using its drive letter rather than a UNC path.