Welcome to the new DelphiDabbler Code Library Documentation.

This is a new site that's currently running on alpha code. There are going to be bugs. If you discover any, please report them on the site's issues page (GitHub account required). Thanks.

Warning: Many URLs are going to change. Refer to the README file to discover which library project's documentation has been completed.

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:

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.