exec (STRING* program, STRING* options);
Starts an external program or batch file.
exec_wait (STRING* program, STRING* options);
Starts an external program or batch file, and waits for its termination.
Parameters:
program - file name of the exe or batch file.
options - command line parameter to be passed to the
program.
Returns:
0 if the program was not found or could not be started, nonzero otherwise.
Speed:
Slow
Remarks:
- The program parameter can
specify a full path (from the root), a partial path (from the current work folder),
or just a filename. In the latter case the exec function first looks for the
file in the work folder, and then in the in the folders specified by the system's
PATH
environment variable.
- If the program string
does not have a filename extension, the exec function first tries
the .COM extension, then the .EXE extension, then the .BAT extension, and
finally the .CMD
extension.
- '\' characters in
strings, like for file paths, have to be given in C-Notation as "\\",
like in "C:\\program files\\internet explorer\\iexplore.exe".
- The instruction
does not wait for the program to terminate, but returns immediately.
- If the external
program opens a window, the engine should be switched to window mode
before. Fullscreen
mode would hide other windows.
Example:
exec("myprogram.exe","");
See also:
path
► latest
version online