Working With the Universal Naming Convention (UNC Path)

An explanation of UNC path names in Windows

The Universal Naming Convention is the naming system used in Microsoft Windows for accessing shared network folders and printers on a local area network.

Support for working with UNC paths in Unix and other operating systems use cross-platform file sharing technologies like Samba.

UNC Name Syntax

UNC names identify network resources using a specific notation. These names consist of three parts: a host device name, a share name, and an optional file path.

A screenshot of the UNC showing a host device name, a share name, and an optional file path.

These three elements are combined using backslashes:

\\host-name\share-name\file_path

The Host-Name Section

The host-name portion of a UNC name can consist of either a network name string set by an administrator and maintained by a network naming service like DNS or WINS, or by an IP address.

These hostnames normally refer to either a Windows PC or a Windows-compatible printer.

The Share-Name Section

The share-name portion of a UNC pathname references a label created by an administrator or, in some cases, within the operating system.

In most versions of Microsoft Windows, the built-in share name admin$ refers to the root directory of the operating system installation—usually C:\Windows but sometimes C:\\WINDOWS or C:\\WINNT.

UNC paths do not include Windows driver letters, only a label that may reference a particular drive.

The File_Path Section

The file_path portion of a UNC name references a local subdirectory beneath the share section. This part of the path is optional.

When no file_path is specified, the UNC path simply points to the top-level folder of the share.

The file_path must be absolute. Relative paths are not allowed.

How to Work With UNC Paths

Consider a standard Windows PC or Windows-compatible printer named Teela. In addition to the built-in admin$ share, say you have also defined a share point called temp that is located at C:\temp.

Using UNC names, this is how you would connect to folders on Teela.

\\teela\admin$ (to reach C:\WINNT)
\\teela\admin$\system32 (to reach C:\WINNT\system32)
\\teela\temp (to reach C:\temp)

New UNC shares can be created through Windows Explorer. Just right-click a folder and choose one of the Share menu options to assign it a share name.

What About Other Backslashes in Windows?

Microsoft uses other backslashes throughout Windows, such as in the local file system. One example is C:\Users\Administrator\Downloads to show the path to the Downloads folder in the Administrator user account.

You might also see backslashes when working with command-line commands, such as:

net use h: * \\computer\files

Alternatives to UNC

Using Windows Explorer or the Command Prompt or Windows PowerShell, and with proper security credentials, you can map network drives and remotely access folders on a computer using its drive letter rather than a UNC path

Microsoft established UNC for Windows after Unix systems had defined a different pathname convention. Unix network paths (including Unix and Linux related operating systems like macOS and Android) use forward slashes instead of backslashes.