共用方式為


Error Event

Event that is fired when an error occurs in the remote script.

                      Object_Error

Parameters

  • object
    WshRemote object.

Remarks

The remote script object fires the Error event when the remote script terminates prematurely. The Error property contains the WshRemoteError object (which holds information about the error that caused the remote script to terminate prematurely).

Example

var WshController = new ActiveXObject("WSHController");
var RemoteProc = WshController.CreateScript("app.wsf", "remotemachine");
WScript.ConnectObject(RemoteProc, "RemoteProc_");
var Done = false;
RemoteProc.Execute();
while (!Done)
   WScript.Sleep(100);

function RemoteProc_End()
{
   WScript.Echo("The process has ended");
   Done = true;
}

function RemoteProc_Error()
{
   WScript.Echo("An error has occurred: " + RemoteProc.Error.Description);
   Done = true;
}

function RemoteProc_Start()
{
   WScript.Echo("The process has started");
}

Applies To:

WshRemote Object

See Also

Reference

WshController Object

WshRemoteError Object

Status Property (WshRemote)

Error Property (WshRemote)

Execute Method (Windows Script Host)

Terminate Method (WshScriptExec)

Start Event

End Event