ProvideX V8.20 > Language Reference > 2. Directives
162
INVOKE Directive
      Execute Operating System Command
Formats
INVOKE [HIDE] [WAIT] [CONTROL] command$ [,ERR=stmtref]
Where:
command$
String expression to be passed to the operating system command
processor for execution.
CONTROL
Optional keyword allows a program to invoke an external program
on Vista with the Run as Administrator option. (Windows-only)
HIDE
Optional keyword will minimize the invoked task when it starts.
(Windows-only)
WAIT
Optional keyword causes the ProvideX session to wait until the
application terminates or the user reactivates the task. (Windows-only)
stmtref
Program line number or label to transfer control to.
Note: In Command mode, ProvideX interprets a statement as an INVOKE directive if
it begins with an double quotation mark ( " ).
Description
The INVOKE directive enables a statement in a program to be processed by the
operating system as if it were entered as a command from the terminal. It provides
access to most operating system utilities and facilities from within a ProvideX
program.
In Execution mode, character strings are passed from a program to the operating
system. In Command mode, entering a line of code that starts with a quotation mark
(i.e., "statement") is the same as using the word INVOKE to start the directive.
In Windows, to accommodate the way Windows searches for programs and
determines the type of program to run, it is best to identify the type of file in the
command line (e.g., "XCOPY.EXE" or "MYJOB.BAT"). Under WindX, use INVOKE
"[WDX]...". See [WDX] Direct Action to Client Machine, p.797. If the operating
system command does not use a window when invoked, ProvideX will not wait for
the command to finish as there is no focus change to wait for.
Tip: Use the SYS( ) function instead of the INVOKE directive if you wish to test the
successful conclusion of an operating system command.
If you are not concerned about the return status of a command and are running PVX
UNIX and PVX Windows, there is no difference between using an INVOKE directive
and the SYS( ) function. When SYS( ) is used under Windows, ProvideX waits for the
spawned task to complete or for the program to be reactivated via the mouse. When
the INVOKE directive is used under Windows, ProvideX spawns the task and
continues without waiting for the task to complete.