meta data for this page
ibec_Exec
Syntax
function ibec_Exec(CommandLine : string; Options : string; CallbackBlock : string) : variant;
Description
The ibec_Exec function runs the specified application.
Parameters
CommandLine | The command line (filename plus optional parameters) for the application to be executed. |
Options | String containing additional options delimited with semicolon; possible options are: |
OutFile=<file_name> | Name of the file where the output of the application will be stored. |
ConvertToANSI | If specified, the output will be translated from the OEM-defined character set into an ANSI string. |
CallbackBlock | A callback IBEBlock which will be executed for each output line. The callback IBEBlock must have at least one input parameter, which will be used to pass an output line within it. If there is no callback block use NULL or an empty string as a value of this parameter. |
NoWait | If specified, the callback block and the OutFile option will be ignored. ibec_Exec with the NoWait option just starts the process and returns immediately. |
ShowWindow/HideWindow | By default the ibec_Exec function creates the process with a hidden window, if the NoWait option is not specified. Use the ShowWindow option if you don't need to hide the process window. |
Example
The following example uses the ibec_Exec function to restore a database from a backup copy using GBAK.EXE:
execute ibeblock as begin cbb = 'execute ibeblock (LogStr variant) as begin ibec_Progress(LogStr); end'; res = ibec_Exec('C:\Program Files\Firebird\Bin\gbak.exe -r -v -rep -user SYSDBA -pas masterkey E:\test_db.fbk E:\test_db.fdb', 'OutFile=E:\Restore.log; ConvertToANSI', cbb); if (res = 0) then ibec_ShowMessage('Restore process completed successfully'); else ibec_ShowMessage('Restore process failed with exit code = '||res); end