I had the same problem, but despite the answers above, I found a non-standard solution and would like to share it with you.
First of all, I created an environment.iss file with two methods - one to add the path to the environment path variable, and the second to delete it:
[Code] const EnvironmentKey = 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment'; procedure EnvAddPath(Path: string); var Paths: string; begin { Retrieve current path (use empty string if entry not exists) } if not RegQueryStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths) then Paths := ''; { Skip if string already found in path } if Pos(';' + Uppercase(Path) + ';', ';' + Uppercase(Paths) + ';') > 0 then exit; { App string to the end of the path variable } Paths := Paths + ';'+ Path +';' { Overwrite (or create if missing) path environment variable } if RegWriteStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths) then Log(Format('The [%s] added to PATH: [%s]', [Path, Paths])) else Log(Format('Error while adding the [%s] to PATH: [%s]', [Path, Paths])); end; procedure EnvRemovePath(Path: string); var Paths: string; P: Integer; begin { Skip if registry entry not exists } if not RegQueryStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths) then exit; { Skip if string not found in path } P := Pos(';' + Uppercase(Path) + ';', ';' + Uppercase(Paths) + ';'); if P = 0 then exit; { Update path variable } Delete(Paths, P - 1, Length(Path) + 1); { Overwrite path environment variable } if RegWriteStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths) then Log(Format('The [%s] removed from PATH: [%s]', [Path, Paths])) else Log(Format('Error while removing the [%s] from PATH: [%s]', [Path, Paths])); end;
Reference: RegQueryStringValue , RegWriteStringValue
Now, in the main .iss file, I could include this file and listen to 2 events (for more information on events, see the section Event Functions in the documentation), CurStepChanged add the path after installation, and CurUninstallStepChanged to remove it when the user uninstalls the application. In the example script below, add / remove the bin directory (relative to the installation directory):
#include "environment.iss" [Setup] ChangesEnvironment=true ; More options in setup section as well as other sections like Files, Components, Tasks... [Code] procedure CurStepChanged(CurStep: TSetupStep); begin if CurStep = ssPostInstall then EnvAddPath(ExpandConstant('{app}') +'\bin'); end; procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep); begin if CurUninstallStep = usPostUninstall then EnvRemovePath(ExpandConstant('{app}') +'\bin'); end;
Link: ExpandConstant
Note No. 1 : the installation step add the path only once (ensures repeatability of the installation).
Note # 2 : The delete step removes only one path entry from the variable.
Bonus : installation step with the "Add to PATH" checkbox.

To add an installation step with the "Add to PATH variable" checkbox, define a new task in the [Tasks] section (installed by default):
[Tasks] Name: envPath; Description: "Add to PATH variable"
Then you can check this in the CurStepChanged event:
procedure CurStepChanged(CurStep: TSetupStep); begin if (CurStep = ssPostInstall) and IsTaskSelected('envPath') then EnvAddPath(ExpandConstant('{app}') +'\bin'); end;