Inno Setup Preprocessor: Exec

Prototype

int Exec(str Filename, str? Params, str? WorkingDir, int? Wait, int? ShowCmd)

Description

Executes specified executable or batch file.

The Filename parameter specifies the filename of the executable or batch file. If this does not includes quotes then the function will add them automatically. If you have a single string containing both a filename and parameters (e.g. a command line obtained from an UninstallString registry value), you need not separate them yourself; just pass '>' in this parameter, and the full command line in the Params parameter. (Note that when this is done, the function's special platform-independent support for .bat and .cmd files is disabled; it simply passes the specified command line to CreateProcess without any processing.)

The Params parameter may be used to specify parameters for the process.

The WorkingDir parameter may be used to specify the working directory of the process. If this is omitted or empty it will try to extract a pathname from the Filename parameter and use that as the initial current directory for the process.

The Wait parameter may be set to zero if you don't wish to wait for the process to finish, and non-zero otherwise. By default, non-zero value is assumed.

The ShowCmd parameter may be any of the SW_* constants defined in ISPPBuiltins.iss. Console programs are always hidden and the ShowCmd parameter only affects GUI programs, so always using SW_SHOWNORMAL (the default) instead of SW_HIDE is recommended.

If the Wait parameter is omitted or is non-zero, the function returns the exit code of the process. Otherwise, the function result indicates whether the process has been successfully launched (non-zero for success).

Note: compared to Pascal Scripting's Exec the Wait and ShowCmd parameters are swapped!

See also

ExecAndGetFirstLine