Absolute path

For the environment variable, see PATH (variable).

A path, the general form of the name of a file or directory, specifies a unique location in a file system. A path points to a file system location by following the directory tree hierarchy expressed in a string of characters in which path components, separated by a delimiting character, represent each directory. The delimiting character is most commonly the slash ("/"), the backslash character ("\"), or colon (":"), though some operating systems may use a different delimiter. Paths are used extensively in computer science to represent the directory/file relationships common in modern operating systems, and are essential in the construction of Uniform Resource Locators (URLs).

Systems can use either absolute or relative paths. A full path or absolute path is a path that points to the same location on one file system regardless of the working directory or combined paths. It is usually written in reference to a root directory.

A relative path is a path relative to the working directory of the user or application, so the full absolute path will not have to be given.

Representations of paths by operating system and shell

Operating System Shell Root Directory Directory Separator Current Directory Parent Directory Home Directory Examples
Unix-like OS Unix shell / / . .. ~ /home/user/docs/Letter.txt
DOS COMMAND.COM [drive letter:]\ or
\\[server name]\[volume]\
/ or \ (note: command.com does not treat / as a directory separator) . .. C:\USER\DOCS\LETTER.TXT
OS/2 cmd.exe [drive letter:]\ / or \ . .. C:\user\docs\Letter.txt


Microsoft Windows cmd.exe \ (relative to %CD%)
or [drive_letter]:\
or \\[server]\[sharename]\
or \\?\[drive_spec]:\
or \\?\[server]\[sharename]\
or \\?\UNC\[server]\[sharename]\
or \\.\[physical_device]\
/ or \ . .. C:\user\docs\Letter.txt
Microsoft Windows Windows PowerShell [drive name:]/ or [drive name:]\or
\\[server name]\ or

[PSSnapIn name]\[PSProvider name:][:PSDrive root]

/ or \ . .. ~ C:\user\docs\Letter.txt
cd ~\Desktop


TOPS-20 DCL [device name:] . PS:LETTER.TXT,4
RSX-11 DCL [device name:] DR0:[30,12]LETTER.TXT;4
OpenVMS DCL [device name:] or

[NODE["accountname password"]]::[device name]:



Classic Mac OS [volume or drive name]: : : :: Macintosh HD:Documents:Letter
ProDOS AppleSoft BASIC /[volume or drive name]/ / /SCHOOL.DISK/APPLEWORKS/MY.REPORT


AmigaOS Amiga CLI / AmigaShell [drive, volume, device or assign name]: / . / Workbench:Utilities/MultiView
TCP:en.World Heritage Encyclopedia.com/80
RISC OS Task window [fs type[#option]:][:drive number or disc name.]$

note: &, % and @ can also be used to reference the root of the current user, the library and the current (working) directory respectively.

. @ ^ & ADFS::MyDrive.$.Documents.Letter

When filesystems with filename extensions are mounted, '.' characters are changed to '/', as in the Japan/gif example above.

Symbian OS File manager \ \ \user\docs\Letter.txt
Domain/OS Shell // /
MenuetOS CMD / /
Stratus VOS VOS command-line interpreter %[system_name]#[module_name]> > <
NonStop Kernel TACL Tandem Advanced Command Language No root . No parent directory \NODE.$DISK.SUBVOL.FILE



CP/M CCP [drive letter:] no subdirectories no subdirectories no parent no subdirectories A:LETTER.TXT

Japanese and Korean versions of Windows may often display the '

Mac OS X, as a derivative of UNIX, uses UNIX paths internally. However, to preserve compatibility for software and familiarity for users, many portions of the GUI switch "/" typed by the user to ":" internally, and switch them back when displaying filenames (a ":" entered by the user is also changed into "/" but the inverse translation does not happen).

Uniform Naming Convention

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:


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


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":


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 /[\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#: @"\\\\".

POSIX pathname definition

A few Unix-like systems use a similar syntax.[3] POSIX allows treating a path beginning with two slashes in an implementation-defined manner,[4] though in other cases systems must treat multiple slashes as single slashes.[5] Many applications on Unix-like systems (for example, scp, rcp and rsync) use resource definitions such as:


or like URLs with the service name (here 'smb'):



Unix style

The following worked example discusses the behavior of a Unix-style file system as it would appear from a terminal or terminal application (command-line window):

Attached to a current working directory (cwd) of:


One wants to change the current working directory to:


At that moment, the relative path for the desired directory can be represented as:


or for short:


and the absolute path for the directory as:


Given bobapples as the relative path for the directory wanted, the following may be typed at the command prompt to change the current working directory to bobapples:

cd bobapples

Two dots ("..") point upwards in the hierarchy, to indicate the parent directory; one dot (".") represents the current directory itself. Both can be components of a complex relative path (e.g., "../mark/./bobapples"), where "." alone or as the first component of such a relative path represents the working directory. (Using "./foo" to refer to a file "foo" in the current working directory can sometimes usefully distinguish it from a resource "foo" to be found in a default directory or by other means; for example, to view a specific version of a manual page instead of the one installed in the system.)

MS-DOS/Microsoft Windows style

Contrary to popular belief, the Windows system API accepts slash, and thus all the above Unix examples should work. But many applications on Windows interpret a slash for other purposes or treat it as an invalid character, and thus require you to enter backslash — notably the cmd.exe shell (often called the "terminal" as it typically runs in a terminal window). Note that many other shells available for Windows, such as tcsh and Windows PowerShell, allow the slash.

In addition "\" does not indicate a single root, but instead the root of the "current disk". Indicating a file on a disk other than the current one requires prefixing a drive letter and colon. No ambiguity ensues, because colon is not a valid character in an MS-DOS filename, and thus one cannot have a file called "A:" in the current directory.

UNC names (any path starting with \\?\) do not support slashes.[6]

The following examples show MS-DOS/Windows-style paths, with backslashes used to match the most common syntax:


This path points to a file with the name File.txt, located in the directory Temp, which in turn is located in the root directory of the drive A:.


This path refers to a file called File.txt located in the parent directory of the current directory on drive C:.


This path denotes a file called File.txt located in SubFolder directory which in turn is located in Folder directory which is located in the current directory of the current drive (since this example gives no drive-specification).


This rather simple path points to a file named File.txt located in the current directory (since the path lacks a directory-specification) on the current drive (since no drive specification is present).


This path refers to the first serial port (COM1).

 C:\>more < C:/Windows/system.ini
 ; for 16-bit app support

This example uses a path containing slashes as directory separator. The command redirects the content of the file to the more command.

E:\>dir "/Folder/SubFolder/" /Q
 Volume in drive E is Data
 Volume Serial Number is 07BE-0B10

 Directory of E:\Folder\SubFolder

18 October 2008 08:15 AM  DOMAIN\user .
18 October 2008 08:15 AM  DOMAIN\user ..
18 October 2008 08:15 AM  DOMAIN\user File.txt
               1 File(s)          8 bytes
               2 Dir(s)  19,063,000 bytes free

A path containing forward slashes often needs to be surrounded by double quotes to disambiguate it from command line switches.

  • note: CD does not work this way:

CD "[drive letter]:/Program Files" will only work from the root ([drive letter]:\) directory. This appears to treat all forward slashes the same as .\.

  • exception: Use the /D switch to change current drive in addition to changing current directory for a drive.

For example:

CD "C:.\Program Files"

works the same as

CD "C:/Program Files"

Also, from a root folder:

CD "C:.\Program Files.\Internet Explorer"

would be treated the same as

CD "C:/Program Files/Internet Explorer"

If there is no relative path to the directory name specified with forward slashes you will get the following error:

The system cannot find the path specified.

For setting environment variables, it is sometimes necessary to provide a path that does not contain spaces in it, for instance %JAVA_HOME% defined as "C:\Program Files\Java..." can cause scripts to halt when they encounter the space in the path name. To get the eight-character name Windows assigns to any directory for substitution in environment variables, use the directory listing command with the /x option one level up from the target directory. For instance, the following will get you the eight character name for all directories directly under root:

C:\> dir /x

UNC in Windows

UNC stands for Universal Naming Convention.

Command Prompt does not support having a UNC path as the current directory, so CD \\host\directoryname does not work. If an attempt is made to start CMD with a UNC current directory then it forces it to C:\Windows. It does not appear to be possible to determine the original working directory.

However, in at least Windows 7 and later PUSHD \\host\directoryname does work, by creating temporary network drive where the drive letter assigned is the last available drive letter starting at Z:. In this case the "host" is a particular type of domain name of some computer on the internet (for example \\live.sysinternals.com). The "directory name" is the optional specification of the name of a directory on the host.

And in Windows 7 and later you can also enter the command START \\host\directoryname in a console to open a GUI window on that directory (which may be the root directory on the "host").

And in Windows 7 you can also open a window on ANY drive or directory and then click on a BLANK area in the "location" bar in the GUI window and enter a UNC name as before to open that GUI window on that host(/directory) as above.

The syntax %~dp0 does expand correctly to the full UNC path of the current batch file.

The POPD command releases the temporary drive letter.

See also


This article is based on material taken from the Free On-line Dictionary of Computing prior to 1 November 2008 and incorporated under the "relicensing" terms of the GFDL, version 1.3 or later.

External links

  • Path Definition - by The Linux Information Project (LINFO)
  • MSDN Library: Naming Files, Paths, and Namespaces

This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.