该事件在远程脚本出错时引发。
Object_Error
当远程脚本过早终止时,远程脚本对象会引发 Error 事件。Error 属性中包含 WshRemoteError 对象(该对象带有有关导致远程脚本过早终止的错误的信息)。
var WshController = new ActiveXObject("WSHController");
var RemoteProc = WshController.CreateScript("foo.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");
}
WshController 对象 | WshRemote 对象 | WshRemoteError 对象 | Status 属性 | Error 属性 | Execute 方法 | Terminate 方法 | Start 事件 | End 事件