Character Property


Reports the specific character in a line of code that contains an error.



WshRemoteError object.

The Character property returns a signed long integer.

Some errors are not associated with a particular character position. For example, consider the error Expected End If. In this case, there is no line (a line of code is missing). In such a case, the Character property returns zero (0).

The character position is based on an offset of one (1) (the first character in a line resides at position one).

Legacy Code Example

The following JScript code demonstrates how the WshRemoteError object exposes the character in the line of code that contained the error.

Dim Controller, RemoteScript
Set Controller = WScript.CreateObject("WSHController")
Set RemoteScript = Controller.CreateScript("test.js", "remoteserver")
WScript.ConnectObject RemoteScript, "remote_"

Do While RemoteScript.Status <> 2 
    WScript.Sleep 100

Sub remote_Error
    Dim theError
    Set theError = RemoteScript.Error
    WScript.Echo "Error - Line: " & theError.Line & ", Char: " & theError.Character & vbCrLf & "Description: " & theError.Description
    WScript.Quit -1
End Sub
var Controller = WScript.CreateObject("WSHController");
var RemoteScript = Controller.CreateScript("test.js", "remoteserver");
WScript.ConnectObject(RemoteScript, "remote_");

while (RemoteScript.Status != 2) {

function remote_Error()
    var theError = RemoteScript.Error;
    WScript.Echo("Error - Line: " + theError.Line + ", Char: " + theError.Character + "\nDescription: " + theError.Description);