SFX commands: SetupCode


SetupCode[=Param]

If this command is present, SFX archive waits until a program specified in Setup or Presetup command finishes and uses its exit code as the exit code of SFX executable.

If SFX failed to run a setup program because of some error, it returns its own error codes, which are the same as WinRAR exit codes.

Since a setup program and SFX module can use same exit code values to define various events, this command allows to map codes to different areas.

If Param is a positive integer, it is added to setup program codes. SFX own codes are returned as is.

If Param is a negative integer, its absolute value is added to SFX own codes. Setup program codes are returned as is.

If Param is 0, both SFX and setup codes are returned as is.

If param is omitted, 1000 is assumed, so "SetupCode" and "SetupCode=1000" are equal.

Let's suppose we have "SetupCode=1000" command. If SFX failed to run a setup program, SFX will return its own error code less than 1000, such as 3 for checksum error. If SFX successfully started a setup program and it is completed with zero code, SFX will return 1000. If setup program returned 10, SFX will return 1010.

If we have the negative integer "SetupCode=-1000" command, SFX will return 1003 in case of checksum error, 0 for setup program returning 0 and 10 for setup returning 10.

If several Setup and Presetup commands are used and SetupCode is present, SFX will wait for every Setup and Presetup command and return a largest code returned by setup applications.

Example

Setup=setup.exe

SetupCode