Skip to content

Latest commit

 

History

History
37 lines (21 loc) · 1.77 KB

TPJCustomConsoleApp-Execute.md

File metadata and controls

37 lines (21 loc) · 1.77 KB

Execute method

Project: Console Application Runner Classes

Unit: PJConsoleApp

Classes: TPJCustomConsoleApp, TPJConsoleApp

Applies to: ~>3.0

function Execute(const CmdLine, CurrentDir: string = ''): Boolean; overload;
function Execute: Boolean; overload;

Description

Executes the command line application.

There are two overloaded versions of the method.

The first overload has the command line and (optionally) the current directory passed as parameters:

  • CmdLine: Command line to be executed. This should include the name of the application (with path if necessary) along with any required parameters. Paths and parameters containing spaces should be enclosed in double quotes.
  • CurrentDir: The directory that the application is to treat as its current directory.

The second overload takes no parameters. It executes the command line specified by the CommandLine property with the current directory specified by the CurrentDir property.

Execute returns True if the application was executed successfully and False if the application failed to run. When False is returned, the ErrorCode property will contain a non-zero error code.

Remarks

If the current directory (however specified) is the empty string then the executed application's current directory will be that of its parent process.

If the CmdLine parameter is specified then the CommandLine property will be updated to the same value.

Similarly the CurrentDir property receives the value of any CurrentDir parameter.