Relative vs. Absolute Paths

File and folder locations are important to Autorun projects. Those file and folder locations often vary from the development environment to the CD being created. Additionally, the folder structure of both the development environment and the CD will likely vary from the machine on which the program will be run. Not considering relative and absolute paths can have an adverse impact.

 

An absolute path is the most commonly seen and used type; it explicitly states the drive, the folder (or folders) and conditionally a filename.

Examples:

C:\my documents\myfile.txt

C:\windows\temporary internet files\mygrahic.gif

 

 

A relative path is an implied path. When a command is expressed that references folders or files (or folders and a file) the current, working drive and directory is the implied path. Therefore, a relative path is stated in relation to the current, working drive.

 


Example 1
mygraphic.gif This .gif file is in the current directory. The current directory is designated by: (name), (.\name), or (name\).
.\mygraphic.gif (This means the same thing as the one above.)  
mygraphic.gif\ (This would be another way of saying the same thing.)  
Example 2
..\mygraphic.gif This .gif file is back one directory from the current directory. To move back a directory another period or the name of the directory must be added before the current directory’s name: (..\name) or (new\name).
Example 3
\windows\mydocuments\ mygraphic.gif This is a little tricky- to access the file, we have to back up to the Root directory and then follow the path. Paths starting with a backslash (\) mean that the Root directory must be accessed first to follow the path.

 

Moon Valley Software