Search code examples
inno-setupexit-code

How can I set the exit code in Inno Setup?


I want to set the exit code for my installation, this way I will know why the installation was aborted. I'm using Inno Setup.


Solution

  • Use:

    [Code]
    procedure ExitProcess(exitCode:integer);
      external 'ExitProcess@kernel32.dll stdcall';
    
    procedure SomeEventHere();
    begin
      if someerror then begin
        ExitProcess(9); //Your custom exit code
      end;
    end;