我在我的 VBscript 中遇到“无效字符”错误!特别是,在这段代码中:
'*******************************************************************
'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
错误Microsoft VBScript compilation error. Invalid Character. Code: 800A0408
在 Char: 2, Line 206 上显示“”,这是第一个字母ExecuteGlobal objFile.ReadAll
(字符 1 是制表符)。
我已经键入并重新键入了该行以及周围的换行符。不过,它一直说“无效字符”。到底是怎么回事??