DelphiDabbler Wiki



Docs.TPJCustomConsoleAppExecute History

Hide minor edits - Show changes to output

May 08, 2011, at 12:47 PM by PJ - Corrected main heading
Changed line 1 from:
!%docref%[[ConsoleApp | Console Application Runner Classes]]%%DoWork method
to:
!%docref%[[ConsoleApp | Console Application Runner Classes]]%%Execute method
May 08, 2011, at 12:47 PM by PJ - New page for TPJCustomConsoleApp.Execute method
Added lines 1-45:
!%docref%[[ConsoleApp | Console Application Runner Classes]]%%DoWork method

'''Project:''' [[ConsoleAppAPI | Console Application Runner Classes]]

'''Unit:''' %var%[[PJConsoleApp(Unit)]]%%

'''Classes:''' %var%[[TPJCustomConsoleApp]]%%, %var%[[TPJConsoleApp]]%%

'''Introduced:''' v1.0

>>frame<<
[@
function Execute(const CmdLine, CurrentDir: string = ''): Boolean; overload;
@]
>><<

'''Introduced:''' v2.0

>>frame<<
[@
function Execute: Boolean; overload;
@]
>><<

!! Description

Executes the command line application.

The first, original version of the method has the command line and (optionally) the current directory passed as parameters:

* %var%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.

* %var%CurrentDir%%: The directory that the application is to treat as its current directory.

The second, parameterless, version of the method was introduced in version 2. It executes the command line specified by the %var%[[(TPJCustomConsoleApp)CommandLine]]%% property with the current directory specified by the %var%[[(TPJCustomConsoleApp)CurrentDir]]%% property.

%var%Execute%% returns @@True@@ if the application was executed successfully and @@False@@ if the application failed to run. When @@False@@ is returned, the %var%[[(TPJCustomConsoleApp)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 %var%CmdLine%% parameter is specified then the %var%[[(TPJCustomConsoleApp)CommandLine ]]%% property will be updated to the same value.

Similarly the %var%[[(TPJCustomConsoleApp)CurrentDir]]%% property receives the value of any %var%CurrentDir%% parameter.
Page last modified on May 08, 2011, at 12:47 PM