In fact, there are a lot of Windows file path description methods Summary



The file path description method is very simple in macOS and Linux, but there are many file path description methods in Windows. Erik Jälevik, who develops the file management application ``

Fileside '', summarizes the results of investigating such Windows file paths.

The weird world of Windows file paths | Fileside
https://www.fileside.app/blog/2023-03-17_windows-file-paths/

File Path Format for Windows Systems | Microsoft Learn
https://learn.microsoft.com/ja-jp/dotnet/standard/io/file-path-formats

There are two types of file paths: the 'absolute path' that describes the entire path to each file, and the 'relative path' that indicates the path from the current location to the target file. The path description method that can be used in Windows is as follows. In the Japanese version of Windows, folders are separated by '\' such as 'C:\Program Files\Mozilla Firefox', but this time it is widely used overseas such as 'C:\Program Files\Mozilla Firefox' Describe it using the delimiter '\' that is used.

◆ Absolute path
・Normal pass
By arranging the folders in order following the drive letter, you can write an absolute path that can indicate a unique location regardless of the location of the working folder.
[code]C:\Program Files\Mozilla Firefox[/code]



・UNC path
UNC stands for 'Universal Naming Convention', and a UNC path is a path that indicates the location of folders and files stored on a device on the network. For example, the location of the 'Media' folder in the device at the IP address '192.168.1.15' can be expressed as follows.
[code]\\192.168.1.15\Media[/code]



The IP address part can be replaced with the name of the device. For example, if '192.168.1.15' was named 'Backup', it can be written as follows.
[code]\\Backup\Media[/code]



It is also possible to access a local folder by specifying its own address as follows.
[code]\\localhost\C$\Windows
\\computer name\C$\Users\Windows
\\local IP address\C$\Users\Windows[/code]



Below is an example of actually accessing a local folder using a UNC path. First, open File Explorer and enter the UNC path and press Enter. The local IP address of the PC used this time was '192.168.0.77', so I entered '\\192.168.0.77\C$\Windows' and pressed the Enter key.



Then, I was able to access the Windows folder in the C drive as follows.



・Device path
The device path is a path starting with '\\?\' or '\\.\', and can represent the location of peripheral devices such as printers and monitors in addition to folders and files. An example showing the location of the file in the device path is as follows.
[code]\\?\Z:\Backup\Media
\\.\Z:\Backup\Media[/code]



◆Relative path
・Relative path from the current position
If you want to access the folder contained in the current folder, you can write the folder name after '.\'. For example, a relative path from 'C:\Windows' to 'C:\Windows\System32' would be written as '.\System32'.



Also, by arranging two '.' such as '..\', it is possible to express 'path from one level higher'. For example, a relative path from 'C:\Windows\System32' to 'C:\Windows\SystemApps' is shown as '..\SystemApps'.

・A relative path from the root of the current drive
If you write the path starting with '\' without writing the drive letter, you can indicate the relative path from the root of the drive you are working on. For example, the relative path to locate 'C:\Windows' when working within the C drive is '\Windows'.

・Relative path from the current folder in the specified drive
If you remove the '\' after the drive letter like 'C:Windows\System32', you can indicate the 'relative path from the current folder in the specified drive'. However, according to Microsoft'sofficial documentation , many bugs are caused by using ``relative path from the current folder in the specified drive'' instead of an absolute path.



in Software, Posted by log1o_hf