I'm wondering about the period character . used as a shortcut for the local computer name. You can use it when logging into Windows 7, for example, to specify that the user account you're entering belongs to the local computer rather than to a domain:


And you can use it within a Windows Management Instrumentation (WMI) query to indicate that the target is the local computer rather than a remote computer. You can also use it when working with named pipes to for similar purposes.

However, you cannot use it as the UNC network name for the computer, like this:


Does this character have an official name (e.g. "LocalHostToken") and when and where can it be used for this purpose?

  • @random -- How is this question looking for a software recommendation? That's not what I'm after at all. – rory.ap Dec 24 '14 at 14:18
  • 1
    You're asking for a reference document, that's the reason it's out of scope – random Dec 24 '14 at 14:23
  • @random -- I've updated my question to make it hopefully more on topic. – rory.ap Dec 24 '14 at 16:49

This Microsoft article has a good description of \\.\ :
Naming Files, Paths, and Namespaces - Win32 Device Namespaces.

The article says :

The \\.\ prefix will access the Win32 device namespace instead of the Win32 file namespace. This is how access to physical disks and volumes is accomplished directly, without going through the file system, if the API supports this type of access. You can access many devices other than disks this way (using the CreateFile and DefineDosDevice functions, for example).

For example, if you want to open the system's serial communications port 1, you can use "COM1" in the call to the CreateFile function. This works because COM1–COM9 are part of the reserved names in the NT namespace, although using the \\.\ prefix will also work with these device names. By comparison, if you have a 100 port serial expansion board installed and want to open COM56, you cannot open it using "COM56" because there is no predefined NT namespace for COM56. You will need to open it using \\.\COM56 because \\.\ goes directly to the device namespace without attempting to locate a predefined alias.

Another example of using the Win32 device namespace is using the CreateFile function with \\.\PhysicalDiskX (where X is a valid integer value) or \\.\CdRomX. This allows you to access those devices directly, bypassing the file system. This works because these device names are created by the system as these devices are enumerated, and some drivers will also create other aliases in the system. For example, the device driver that implements the name "C:\" has its own namespace that also happens to be the file system.

APIs that go through the CreateFile function generally work with the \\.\ prefix because CreateFile is the function used to open both files and devices, depending on the parameters you use.

If you're working with Windows API functions, you should use the \\.\ prefix to access devices only and not files.

Most APIs won't support \\.\; only those that are designed to work with the device namespace will recognize it. Always check the reference topic for each API to be sure.

This device-addressing convention should always work in the Command Prompt (cmd), beside other applications.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.