How to create relative file paths

G

Guest

I know that XP accepts many file path naming conventions other than a full
absolute file path such as "C:\program files\microsoft
office\documents\file.doc", and etc. I have seen a variety of shorthand
methods for naming file paths and some that appear to be relative file paths
that reference a child folder, or parent folder, or perhaps no folder at all
if the file being referenced is in the same folder as the application that
uses it. This would seem to be an absolute necessity, for the sake of
portability from one machine to another, where a file that references or is
referenced by another file may be located somewhere other than in its
original location. Some of the formats I have seen are things like
"\\localhost\foldername", "...\filename", or "\\foldername\\filename" and
etc.

Where can I find detailed information such as formats, purpose, when to use
which one, foward slash or back slash, single slash or double slash, and the
like regarding path naming conventions?
 
C

Cymbal Man Freq.

Maybe when installing Windows, installing into a directory other than the
default Windows folder would be appropriate? Say, installing into the
"WindowsC" folder instead of the "Windows" folder, just slightly altering the
name of the folder so that the spyware junk out there won't find the "Windows"
folder flat-out; you could create a dummy folder called "Windows" for all the
spyware to find nothing in it.

We may need to encrypt the name of the Windows folder so the spyware junk won't
find it!
 
G

glee

Alternate windir names was a popular and useful method that has been used for over a
decade, but these days I think it is a little less effective, as more sophisticated
malware can find the windows directory fairly quickly now, using variables. It may
protect somewhat from some of the less-smart malware.

Encrypting the name of the Windows directory may leave you with other problems, like
installers not being able to find it!
 
S

Shenan Stanley

Cymbal said:
Maybe when installing Windows, installing into a directory other than
the default Windows folder would be appropriate? Say, installing into
the "WindowsC" folder instead of the "Windows" folder, just slightly
altering the name of the folder so that the spyware junk out there
won't find the "Windows" folder flat-out; you could create a dummy
folder called "Windows" for all the spyware to find nothing in it.

We may need to encrypt the name of the Windows folder so the spyware
junk won't find it!

Wouldn't help.. Environment variables contain your system directory and
much more..

Open a CMD prompt and type in:

SET

and press ENTER. See the environement variables that can be accessed by any
running application?

--
=- Shenan -=<
=- MS MVP -=<
--
The information above is intended to assist you; however, it is
suggested you research for yourself before you take any advice - you
are the one ultimately responsible for your actions/problems/solutions.
Whenever possible, the advice will include the method/places used in
compiling the answer. Also, questions may have been asked to clarify
your situation OR to give you an idea of where to look - do not dismiss
them lightly.
 
G

Guest

Wow, you guys are somewhere else. My question is about how to create relative
file paths (for lack of better terminology) and shorthand methods for naming
paths between files and folders. I didn't think it had anything to do with
navigating a network, trying to outsmart spyware, what directory I should
install programs in, or encryption.

Let me try to give a simple example:

I have 2 folders. (not really, but lets pretend OK)
Here are their absolute locations:

Folder 1 is at location C:\2dogs\my documents\folder1
Folder 2 is at location C:\2dogs\my documents\folder1\folder2

I also have 3 files. (not really, but lets pretend again OK)
Here are their absolute path names:

File 1 is C:\2dogs\my documents\folder1\main file
File 2 is C:\2dogs\my documents\folder1\sub file
File 3 is C:\2dogs\my documents\folder1\folder2\image

In File 1 there is a reference to File 2 that is in the same folder. File 1
refers to File 2 by using the absolute path name to File 2. In File 1 there
is also a reference to File 3 that is in a folder that is 1 level farther
down in the directory tree. File 1 refers to File 3 by using the absolute
path name to File 3.

I send the 2 folders (folder1 with folder2 inside it) to Bill (don't worry
about who Bill is because we are still pretending OK). Bill puts the folders
in his personal folder on his D: drive. So now the paths to the folders are:

D:\Bill\Personal Folder\folder1
D:\Bill\Personal Folder\folder1\folder2

When Bill opens the files and tries to use them they will not work because
all the references in those files point to locations that no longer exist.
That is because the references were absolute file paths that point to a
location on 2dogs C: drive.

There are methods for giving references using relative path names instead of
absolute path names and also methods for abbreviating path names both
relative and absolute. I Can't give better examples because I don't know
anymore about the subject. I have queried the Microsoft DB for hours and have
found nothing on this subject. These techniques must be documented somewhere.
My question is; Where?
 
G

glee

Replied inline.....
2dogs said:
Wow, you guys are somewhere else. My question is about how to create relative
file paths (for lack of better terminology) and shorthand methods for naming
paths between files and folders. I didn't think it had anything to do with
navigating a network, trying to outsmart spyware, what directory I should
install programs in, or encryption.

Wow, why did you use an example of UNC ("\\localhost\foldername") when you aren't
referring to a network? You sort of got what you asked for. ;-)
Let me try to give a simple example:

I have 2 folders. (not really, but lets pretend OK)
OK

Here are their absolute locations:

Folder 1 is at location C:\2dogs\my documents\folder1
Folder 2 is at location C:\2dogs\my documents\folder1\folder2
SF,SG

I also have 3 files. (not really, but lets pretend again OK)
Here are their absolute path names:

File 1 is C:\2dogs\my documents\folder1\main file
File 2 is C:\2dogs\my documents\folder1\sub file
File 3 is C:\2dogs\my documents\folder1\folder2\image
OK....

In File 1 there is a reference to File 2 that is in the same folder. File 1
refers to File 2 by using the absolute path name to File 2. In File 1 there
is also a reference to File 3 that is in a folder that is 1 level farther
down in the directory tree. File 1 refers to File 3 by using the absolute
path name to File 3.

It depends what kind of file File1 is, which contains the "references" to File2 and
File3. If it is an HTML file, you use HTML syntax to write the references, either
using absolute or relative paths. What filetype is File1?
I send the 2 folders (folder1 with folder2 inside it) to Bill (don't worry
about who Bill is because we are still pretending OK). Bill puts the folders
in his personal folder on his D: drive. So now the paths to the folders are:

D:\Bill\Personal Folder\folder1
D:\Bill\Personal Folder\folder1\folder2

When Bill opens the files and tries to use them they will not work because
all the references in those files point to locations that no longer exist.
That is because the references were absolute file paths that point to a
location on 2dogs C: drive.

Again, if it is an HTML file, you use relative paths per the syntax used in HTML.
What is the filetype of File1?
There are methods for giving references using relative path names instead of
absolute path names and also methods for abbreviating path names both
relative and absolute. I Can't give better examples because I don't know
anymore about the subject. I have queried the Microsoft DB for hours and have
found nothing on this subject. These techniques must be documented somewhere.
My question is; Where?

Depends on what filetype you are using, as I said redundantly above. :) Depending
on the filetype, you probably need to ask in a group dedicated to programs that use
that filetype. (HTML? Word doc? RTF? Database file?)
 
C

Cymbal Man Freq.

ERROR:
Cannot find the file "set" (or one of its components).
Make sure the path and filename are correct and that all required libraries are
available.
 
S

Shenan Stanley

Cymbal said:
Maybe when installing Windows, installing into a directory other
than the default Windows folder would be appropriate? Say,
installing into the "WindowsC" folder instead of the "Windows"
folder, just slightly altering the name of the folder so that the
spyware junk out there won't find the "Windows" folder flat-out;
you could create a dummy folder called "Windows" for all the
spyware to find nothing in it.

We may need to encrypt the name of the Windows folder so the spyware
junk won't find it!

Shenan said:
Wouldn't help.. Environment variables contain your system directory
and much more..

Open a CMD prompt and type in:

SET

and press ENTER. See the environement variables that can be accessed
by any running application?
ERROR:
Cannot find the file "set" (or one of its components).
Make sure the path and filename are correct and that all required
libraries are available.

Please follow the directions given... The results you received are due to
you typing "SET" in the START --> RUN prompt, not the CMD prompt.

If you want to get the results straight from the START --> RUN prompt, you
can type this:

CMD /K SET

Click OK.

(If you type just "CMD", you receive a "Command Prompt"; if you typed just
"COMMAND", you receive a "Command Prompt". Both of these are DOS Emulators
really - as there is no DOS environment in Windows XP. the "CMD" version
gives you more options/tools/long filenames/etc.)

Read more about the Command Prompt:
http://www.microsoft.com/windowsxp/using/helpandsupport/learnmore/ballew_commandline.mspx

Examples of Environment Variables:
http://kennethhunt.com/archives/000933.html
(Notice "SystemRoot"..)

--
=- Shenan -=<
=- MS MVP -=<
--
The information above is intended to assist you; however, it is
suggested you research for yourself before you take any advice - you
are the one ultimately responsible for your actions/problems/solutions.
Whenever possible, the advice will include the method/places used in
compiling the answer. Also, questions may have been asked to clarify
your situation OR to give you an idea of where to look - do not dismiss
them lightly.
 
D

David Candy

Cmd is not a Dos emulator. Command is also not a dos emulator but requires it to run. The black screen that both use is also not Dos but is a console window. Any console program can use it.
 
S

Shenan Stanley

David said:
Cmd is not a Dos emulator. Command is also not a dos emulator but
requires it to run. The black screen that both use is also not Dos
but is a console window. Any console program can use it.

My bad on the wording.. "command interpreter" would have been the proper
terminolgy.
*smile*
Thanks!

--
=- Shenan -=<
=- MS MVP -=<
--
The information above is intended to assist you; however, it is
suggested you research for yourself before you take any advice - you
are the one ultimately responsible for your actions/problems/solutions.
Whenever possible, the advice will include the method/places used in
compiling the answer. Also, questions may have been asked to clarify
your situation OR to give you an idea of where to look - do not dismiss
them lightly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top