Here is an explanation of the difference between a relative and an absolute path, with an example for Windows 11, 10, ... an MS Server OS!For example, the absolute path is 1 C:\Folder1\Folder2\file1.txt In the example above, the absolute path contains the full path to the file and not just the file that is displayed in the non-absolute path.
My working directory 1 is: C:\Folder1\ The relative path to the absolute path is 1 Folder2\file.txt The working directory 1 + relative path result in the absolute path "C:\Folder1\" & "Folder2\file.txt" = C:\Folder1\Folder2\ fileii1.txt You can always use the absolute path to open a file My working directory 2 is: C:\Folder1\Folder3 The relative path to the absolute path 1 ..\folder2\file.txt With ".." you negate the folder3, or change one level higher and you have the correct absolute path again These rules also apply in the Windows command line
The Windows command line can be used to determine the absolute path of any file by looking at the current directory.
If you, for example, C:\Windows\Systwm32\ are (cd = change directory) C:\>cd windows
C:\Windows>
C:\>cd system32
C:\Windows>System32>
C:\Windows>System32>calc.exe
C:\Windows>System32>cd..
C:\Windows>cd..
C:\>cd..
C:\>C:\Windows\System32\calc.exe
C:\>
In other words, the absolute path is the full directory path and file name. FAQ 103: Updated on: 27 July 2021 19:55 |