Exec Method |
Description
Runs an application in a child command-shell, providing access to the StdIn/StdOut/StdErr streams.
PowerBASIC Syntax
Arguments
Remarks
The Exec method returns a IWshExec interface reference, which provides status and error information about a script run with Exec along with access to the StdIn, StdOut, and StdErr channels. The Exec method allows the execution of command line applications only. The Exec method cannot be used to run remote scripts. Do not confuse the Exec method with the Execute method (of the IWshRemote interface).
Example [PowerBASIC]
#INCLUDE "WSHOM.INC"
DIM pWsh3 AS IWshShell3 DIM pWshExec AS IWshExec
pWsh3 = NEWCOM "WScript.Shell" pWshExec = pWsh3.Exec(UCODE$("calc")) DO IF pWshExec.Status <> 0 THEN EXIT DO SLEEP 100 LOOP PRINT "Status: " pWshExec.Status
|