2
votes

I'm using Inno Setup to make setup package and this is my registry code.

[Registry]
; Add php path to windows variable.
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{drive:c:\}\{#WwwServer}\php\php5.5"; Check: NeedsAddPath(ExpandConstant('{drive:c:\}\{#WwwServer}\php\php5.5')); Flags: preservestringtype;

The NeedsAppPath I got it from here "How do I modify the PATH environment variable when running an Inno Setup Installer?".

This can install and add path correctly, but I don't know how to remove path when uninstall.

This is the path I want to remove from Windows PATH variable.
{drive:c:\}\{#WwwServer}\php\php5.5

How to remove this path from Windows PATH when uninstall?

2
I don't think there's a ready made solution for this, so I guess you will need to programatically read the value, remove what you appended and save the value back. Besides, multiple installations of your setup will append multiple paths to the key value. - TLama
@TLama Sadly. I don't know Pascal. :s - vee

2 Answers

2
votes

You can simply put one flag and you are ready!

Flag: uninsdeletevalue

This will delete value of the registry when you uninstall your application.

1
votes

You can simply use Flags: uninsdeletekey in [Registry] section entry to delete the registry key when uninstalling application (it will only delete registry which created by Inno Setup).

For example:

[Registry]
Root: HKLM; SubKey: SOFTWARE\SEGA; Flags: uninsdeletekey

Want to know more, check Registry aren't fully deleting when uninstalling.