Warum VBScript sagen, dass "Ungültige Zeichen" bei der Verwendung von ExecuteGlobal zu importieren .vbs-Funktion library-Datei?

Ich bin der Begegnung ein "Ungültiges Zeichen" - Fehler in meinem VBscript! In bestimmten, in diesem code-block:

'*******************************************************************
'Import Code
'by Cheyne Wallace
'November 2008

'When using only VBscript (not QTP), this code will import any function library passed into it.
'Copy this function into a file, then use it to bring in various other function libraries.
'Usage:
'   Import "Library.vbs"

Sub Import(strFile)
    Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject")
    Dim wss : Set wss = CreateObject("WScript.Shell")
    strFile = wss.ExpandEnvironmentStrings(strFile)
    strFile = objFSO.GetAbsolutePathName(strFile)
    Set objFile = objFSO.OpenTextFile(strFile, 1)
    ExecuteGlobal objFile.ReadAll
    objFile.Close : Set objFSO = nothing
    Set wss = Nothing
End Sub

Die Fehlermeldung heißt "Microsoft VBScript compilation error. Invalid Character. Code: 800A0408" auf Char: 2, Line 206, welcher ist der erste Buchstabe auf ExecuteGlobal objFile.ReadAll (Figur 1 ist ein Register).

Habe ich eingegeben und ein zweites mal eingegeben, die Linie, wie auch die umliegenden Zeilenumbrüche. Trotzdem, es sagt immer 'Ungültige Zeichen'. Was ist Los???

InformationsquelleAutor Eptin | 2012-12-21

Schreibe einen Kommentar