Question about relative path installers...

I have a question about relative paths. I can use relative paths in windows for installers/shortcuts, but not in the windows registry.

I normally avoid using the registry, but sometimes I have to.

One of the problems I have with Windows, is Windows supports relative paths, but the registry doesn't & has to be exact path to work.

____________________________________________________________________________________________________________________________________________________

I will give you an example of the type problem I am having to see if anyone has a potential solution to it.

I like to make programs that can be "swept away" after use, or cleared with CCleaner from the temp folder after use. I use WinRar to pack files together because it makes them smaller on the flash drive, + has advantages using Rar SFX.

- If you make your files smaller, you can fit more on your flash drive

- On launch, they extract to the user harddrive & run from there (less wear on flash drive)

- After being run & closed, they auto cleanup after themselves

First, for those who do not know, here are some examples of some relative paths I use occasionally.

- %tmp% (user temp folder... combined with %tmp%\file folder\exe to run, you can do a lot)

- %windir% (user windows directory)

- %programfiles% (program files folder)

There are many more, but those are some. An exact path would be like C:\Windows\Temp

____________________________________________________________________________________________________________________________________________________

My problem is that normally I have no problem creating a program to run in the temp dir, then cleaning up, but the problem that I have is on some things I make, I have to use the registry.

Normally, I use relative paths to make things easier, but if I have to have a registry key imported before I run something that lists the location of the file in the temp folder (Example: C:\Windows\Temp\Folder\Exe to run), then I have to use the whole entire path instead of using a relative directory.

Normally, this works ok, except in cases where you need to run it on multiple machines. Not everyone installs to C:\Windows.

Some people dual, triple, or even quad boot windows. In such cases, sometimes Windows may be on D:\Windows, E:\Windows, etc.

Is there a way to make it work with multiple drives on situations calling for an exact location registry key?

I wondered if you can somehow make a script that will auto detect the drive letter & substitute it into the reg file before importing it, or

Instead of importing a key, create a registry value to import on the fly by detecting the drive letter & then importing the value.

If there is a way to run things relative path wise in the registry that I am missing, please let me know!

Anyone have any good suggestions/ideas on this? I know some installers check before installing, then create a "new" registry key based on the drive letter of the computer being installed to, but I don't need to use their installer when doing this on my machines, because I need something that can do similarly, but "on the fly" if needed. Having to "install" each time would be painful, when there is no-one there to do things I need done on the machine while away!

If anyone knows, please post here some of the registry tricks you use.

Thanks!

Well...there's %SystemDrive%.

I don't think enviornment variables work for the registry but maybe this will be of help

http://en.wikipedia....crosoft_Windows

though it uses C:\ it will apply to the system set path for that variable.

I don't think enviornment variables work for the registry but maybe this will be of help

I don't know off hand if they do or don't but there are some references in the registry that have them.

I don't know off hand if they do or don't but there are some references in the registry that have them.

Thanks for the replies from everyone. I am checking the wiki link above to see what it is about. I know the registry lists a lot of the variables, but in testing them, it seems they are not picked up if you try to import them & use them for an app.

What I mean is, I can set it to the right relative path, & it works with files, but when I try the same thing for the registry, it seems to fail unless I type the exact path.

I didn't know if anyone knew a workaround/bat file/multi-step process to call up something to change to the right drive letter depending on the drive windows is on, say, C:\, D: etc.

I think I will try moving the files directly to C: & see if the "relative path" of just listing them will work. Whew! If I can find out how to do this, it will be great! I will keep researching & try some of the ideas here. If you think of anything new, just let me know!