RunCommandIndir¶
Run a command in a specific directory.
Declaration¶
Source position: processbody.inc line 262
function RunCommandIndir(const curdir: TProcessString;
const exename: TProcessString;
const commands: Array of TProcessString = String;
out outputstring: string;
out exitstatus: Integer;
Options: TProcessOptions=[];
SWOptions: TShowWindowOptions=swoNone) : Integer;
function RunCommandIndir(const curdir: TProcessString;
const exename: TProcessString;
const commands: Array of TProcessString = String;
out outputstring: string;
Options: TProcessOptions=[];
SWOptions: TShowWindowOptions=swoNone) : Boolean;
function RunCommandInDir(const curdir: TProcessString;
const cmdline: TProcessString;
out outputstring: string) : Boolean;
Description¶
RunCommandInDir will execute binary exename with command-line options commands, setting curdir as the current working directory for the command. The Options are taken into consideration (poRunSuspended,poWaitOnExit are removed from the set). The output of the command is captured, and returned in the string OutputString. The function waits for the command to finish, and returns True if the command was started successfully, False otherwise. In the case where the return value is an integer, it is zero for success, and -1 on error.
If a ExitStatus parameter is specified the exit status of the command is returned in this parameter.
The version using cmdline attempts to split the command line in a binary and separate command-line arguments. This version of the function is deprecated.
Errors¶
On error, False is returned.
See also¶
| Name | Description |
|---|---|
| TProcess | Class to start and control other processes. |
| RunCommand | Execute a command in the current working directory. |
| TProcessOptions | Set of TProcessOption. |