I have a to-portabilize software which creates an autorun entry in
HKCU\Software\Microsoft\Windows\CurrentVersion\Run\
here an extract of my launcher.ini:
[Launch] [...] [Activate] Registry=true [RegistryKeys] [...] mysoftware15=HKCU\Software\Microsoft\Windows\CurrentVersion\Run\MySoftware [...]
Of course, I cannot take the whole \Run key because it's a shared key. Unfortunately, it doesn't get recognized by the launcher. If I understand the documentation right, with
[RegistryValueWrite]
, I explicitely need to declare a value (which I do not want).
Any ideas?
We use RegistryValueBackupDelete since this is a value and not a key, and we don't need to preserve the portable version's entry. Here's a real-world example from Free Download Manager Portable:
Sometimes, the impossible can become possible, if you're awesome!
Thanks so far, this will help me in this case, but leaves this general question open:
As the value will be deleted on exit when set by the portable app, how can such a value be preserved? I could imagine that it would be relevant if using different products from one manufacturer that uses the same key. Surely this isn't a good coding style, but is absolutely not that rare, especially on commercial products when one license includes another product (or vice versa).
could not be used here as changing the whole key would cause side effects.
also cannot be used in this case as the set value would be deleted after closing the app.
also could not be used as I would have to declare an explicit value which isn't always clear before.
Is there a way to preserve a single value?
I think [RegistryKeys] is the way to do it. It backs up the existing key, replaces it with the one form the portable app during runtime and restores the original after closing it (and backs up the one form the portable app). Mixing the existing key with the one from the portable app would most likely mess things up - either breaking portability or destroying the existing values. Think of storing a shared license value. This could be overwritten by the portable app with result that the host machine's license could be replaced by the portable app's one. How would you distinguish the values during runtime?
I consider this the limit of portablizing an app. If you could give a real world example, maybe another solution could be possible. If it could not be achived by the launcher out of the box, there is still the possibility to use custom code.