How to write install path to registry after install is complete with Inno Setup

后端 未结 2 1082
囚心锁ツ
囚心锁ツ 2021-01-18 02:08

How to write install path to registry after install is complete with Inno sSetup?

Thanks in advance!

相关标签:
2条回答
  • 2021-01-18 02:42

    Like TLama said, you can achieve it via ssPostInstall if you want the key to be added after the installation process is complete.

    [Code]
    procedure CurStepChanged(CurStep: TSetupStep);
    begin
      if CurStep=ssPostInstall then begin
         RegWriteStringValue(HKEY_LOCAL_MACHINE, 'Software\HHSTECH',
        'InstallPath', ExpandConstant('{app}'));
      end;
    end;
    

    Or you can use AfterInstall that will be called after the last files is installed (copied).

    [Files]
    Source: ".\THEVERYLASTFILE.XXX"; DestDir: "{app}"; AfterInstall: MyAfterInstall
    
    [Code]
    procedure MyAfterInstall();
    begin
         RegWriteStringValue(HKEY_LOCAL_MACHINE, 'Software\HHSTECH',
        'InstallPath', ExpandConstant('{app}'));
    end;
    
    0 讨论(0)
  • 2021-01-18 03:02
    [Registry]
    Root: HKLM; Subkey: Software\HHSTECH; ValueType: string; ValueName: InstallPath; ValueData: {app}
    
    0 讨论(0)
提交回复
热议问题