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!