The file URI scheme specified in RFC 1630 and RFC 1738, and is typically used to retrieve files from the host computer. Figure 1 below shows NetAnalysis with a number of file entries filtered, as stored by Microsoft Internet Explorer v9 in its history INDEX.DAT files.
These entries are created (along with Microsoft Windows Shortcut entries) by accessing files on the computer system which typically have an HKEY_CLASSES_ROOT entry in the registry to inform Explorer how the file should be dealt with.
The slash character (/), depending on its position, has different meanings within a file URL.
Here are two Unix examples pointing to the same
Here are some examples which may be accepted by some applications on Windows systems, referring to the same, local file
file://localhost/c|/WINDOWS/clock.avi file:///c|/WINDOWS/clock.avi file://localhost/c:/WINDOWS/clock.avi
Here is the URI as understood by the Windows Shell API:
On Microsoft Windows systems, the normal colon (:) after a device letter has sometimes been replaced by a vertical bar (|) in file URLs. This reflected the original URL syntax, which made the colon a reserved character in a path part.
Since Internet Explorer 4, file URIs have been standardised on Windows, and should follow the following scheme. This applies to all applications which use
SHLWAPI for parsing, fetching or binding to URIs. To convert a path to a URL, use
UrlCreateFromPath, and to convert a URL to a path, use
To access a file
"the file.txt", the following might be used.
For a network location:
Or for a local file, the hostname is omitted, but the slash is not (note the third slash):
This is not the same as providing the string "localhost" or the dot "." in place of the hostname. The string "localhost" will attempt to access the file as
\\localhost\c:\path\to\the file.txt, which will not work since the colon is not allowed in a share name. The dot "." results in the string being passed as
\\.\c:\path\to\the file.txt, which will work for local files, but not shares on the local system. For example
file://./sharename/path/to/the%20file.txt will not work, because it will result in sharename being interpreted as part of the DOSDEVICES namespace, not as a network share.
Do not be mistaken that these entries mean the files were opened in the browser. Accessing local files on a Windows system will result in file entries being created.