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

后端 未结 2 1083
囚心锁ツ
囚心锁ツ 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;
    

提交回复
热议问题