Windows Script Host  

Terminate Method (WshScriptExec)

Instructs the script engine to end the process started by the Exec method.

object.Terminate

Arguments

object
WshScriptExec object.

Remarks

The Terminate method does not return a value. Use the Terminate method only as a last resort since some applications do not clean up properly. As a general rule, let the process run its course and end on its own. The Terminate method attempts to end a process using the WM_CLOSE message. If that does not work, it kills the process immediately without going through the normal shutdown procedure.

Example

The following JScript example demonstrates how to use the Terminate method to stop a running script.

var aScript = WScript.Exec("%comspec% /c myScript.js");
aScript.Terminate();

See Also

WshScriptExec Object