Documentation
IPS_Execute
boolean IPS_Execute (string $ProgramPath, string $Parameter, boolean $Dummy, boolean $Wait)
Parameters
ProgramPath | Full path to the program |
Parameter | Parameter which is to be passed to the program (optional) |
Dummy | Always specify true, parameter is not evaluated, this was only used in version 1.x. |
Wait | Specifies whether to wait for the end of the program |
Returns
The return value of stderr/stdout if the Wait parameter is True, otherwise the return is an empty string.
Description
The command causes the start of the external program named ProgramName. The String parameter is passed as a request parameter to the program. The Boolean value Wait determines if the end of the program should be awaited or the calling script should be resumed immediately. While waiting for the results, this appears, if present, as a string in the return value.
As source for the return value comes one of the following program outputs into question:
- Output by stderror
- Output by stdout
If both options are used by the program, stderror receives priority, e.g. to not lose any error messages.
Caution: While waiting for the program to end, the script execution time is extended accordingly. It is important to ensure that in the file "php.ini" the defined maximum duration will not be exceeded. Otherwise, the script exits with an error message. This is especially important if the program expects user input.
Attention: If the program to be started is interactive (e.g. containing a window), this will not be displayed/ visible. It starts in the background as a system process and can only be stopped with the help of the Task Manager. If the program should be displayed on the desktop, the function IPS_ExecuteEx must be used.
Example
//Start a batch file
IPS_Execute("C:/autoexec.bat", "", false, false);