no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
| — | development:inno:add_path_to_reg [2019/10/31 09:04] (current) – created - external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Add {app} to path environment variable in registry ====== | ||
| + | If your installation contains applications that need to be available from anywhere in Windows, and don't wish to create shortcuts, appending {app} variable value to the Windows PATH variable will do the trick. | ||
| + | Add this to the [Code] section in your script: | ||
| + | For adding {app} to all users path variable | ||
| + | <code pascal> | ||
| + | function NeedsAddPathHKLM(Param: | ||
| + | var | ||
| + | OrigPath: string; | ||
| + | begin | ||
| + | if not RegQueryStringValue(HKEY_LOCAL_MACHINE, | ||
| + | ' | ||
| + | ' | ||
| + | then begin | ||
| + | Result := True; | ||
| + | exit; | ||
| + | end; | ||
| + | // look for the path with leading and trailing semicolon | ||
| + | // Pos() returns 0 if not found | ||
| + | Result := Pos(';' | ||
| + | end; | ||
| + | </ | ||
| + | For adding {app} to current user path variable | ||
| + | <code pascal> | ||
| + | function NeedsAddPathHKCU(Param: | ||
| + | var | ||
| + | OrigPath: string; | ||
| + | begin | ||
| + | if not RegQueryStringValue(HKEY_CURRENT_USER, | ||
| + | ' | ||
| + | ' | ||
| + | then begin | ||
| + | Result := True; | ||
| + | exit; | ||
| + | end; | ||
| + | // look for the path with leading and trailing semicolon | ||
| + | // Pos() returns 0 if not found | ||
| + | Result := Pos(';' | ||
| + | end; | ||
| + | </ | ||
| + | In order to use the code, add this to the [Registry] section in your script: | ||
| + | <code pascal> | ||
| + | Root: " | ||
| + | Root: " | ||
| + | </ | ||