Runs an application in a child command-shell, providing access to the StdIn/StdOut/StdErr streams.
Arguments
- object
WshShell object.
- strCommand
String value indicating the command line used to run the script. The command line should appear exactly as it would if you typed it at the command prompt.
Remarks
Example
The following example demonstrates the basics of the Exec method.
Visual Basic Script | Copy Code |
---|
Dim WshShell, oExec
Set WshShell = CreateObject("WScript.Shell")
Set oExec = WshShell.Exec("calc")
Do While oExec.Status = 0
WScript.Sleep 100
Loop
WScript.Echo oExec.Status |
JScript | Copy Code |
---|
var WshShell = new ActiveXObject("WScript.Shell");
var oExec = WshShell.Exec("calc");
while (oExec.Status == 0)
{
WScript.Sleep(100);
}
WScript.Echo(oExec.Status); |
See Also