G
Guest
Hi
I'm using Visual Studio Installer to make my installer, and have not as yet
figured out a straightforward way to use it to set environmental variables.
Amongst the various things I tried, I'm thinking the following might help. I
would appreciate if someone could comment on this idea and possibly suggest a
better one:
The environement variable in question is 'Path' in the HKCU registry
folder's Environment key. I want to add some new values to it, which I want
the installer to remove upon uninstallation.
-----------------
GIVEN
-----------------
1. Using Setx, the new value can be appended to Path
2. What I would then need is to save the already exsisting path value in a
dummy key:
setx TempKey "%Path%"
3. Next, the new value is appened to path:
setx Path "%Path% theValueString"
4. On uninstallation, path can be restored by overwriting with the value
present in TempKey and the temporary key itself can be discarded.
----------------------------
REQUIRED:
----------------------------
Given the above, I'm guessing I would need to make two batch files, one for
installation and one for the uninstallation, and then somehow use the custom
actions editor to run these two batch files at the right time.
----------------------------
POSSIBLE BOTTLENECK:
----------------------------
I have never worked with batch files (though they don't seem overly
complicated), and I have yet to figure out how to use the custom actions
feature for vsi.
----------------------------
DILEMMA:
----------------------------
a) I haven't yet tried out this solution, so I don't absolutely know if it's
attainable.
b) Does there exsist a cleaner way to achieving the same?
Any help would be great.
Thanks a lot!
I'm using Visual Studio Installer to make my installer, and have not as yet
figured out a straightforward way to use it to set environmental variables.
Amongst the various things I tried, I'm thinking the following might help. I
would appreciate if someone could comment on this idea and possibly suggest a
better one:
The environement variable in question is 'Path' in the HKCU registry
folder's Environment key. I want to add some new values to it, which I want
the installer to remove upon uninstallation.
-----------------
GIVEN
-----------------
1. Using Setx, the new value can be appended to Path
2. What I would then need is to save the already exsisting path value in a
dummy key:
setx TempKey "%Path%"
3. Next, the new value is appened to path:
setx Path "%Path% theValueString"
4. On uninstallation, path can be restored by overwriting with the value
present in TempKey and the temporary key itself can be discarded.
----------------------------
REQUIRED:
----------------------------
Given the above, I'm guessing I would need to make two batch files, one for
installation and one for the uninstallation, and then somehow use the custom
actions editor to run these two batch files at the right time.
----------------------------
POSSIBLE BOTTLENECK:
----------------------------
I have never worked with batch files (though they don't seem overly
complicated), and I have yet to figure out how to use the custom actions
feature for vsi.
----------------------------
DILEMMA:
----------------------------
a) I haven't yet tried out this solution, so I don't absolutely know if it's
attainable.
b) Does there exsist a cleaner way to achieving the same?
Any help would be great.
Thanks a lot!