VBScript无效字符800A0408编译错误

当我尝试从Windows 7中的命令提示符运行以下vbs代码时,我收到编译错误。

Option Explicit
Dim objNetwork, strRemotePath1, strRemotePath2, strRemotePath3
Dim strDriveLetter1, strDriveLetter2, strDriveLetter3, strUserName

Set objNetwork = CreateObject("WScript.Network")
strUserName = objNetwork.UserName 

strDriveLetter1 = "H:"
strDriveLetter2 = "P:"
strDriveLetter3 = "S:"
strRemotePath1 = "\\test\public\users\" & strUserName & "\"
strRemotePath2 = "\\test\public\groups\"
strRemotePath3 = "\\test\scans\"


'Section which maps two drives, M: and P: and S:
objNetwork.MapNetworkDrive strDriveLetter1, strRemotePath1
objNetwork.MapNetworkDrive strDriveLetter2, strRemotePath2
objNetwork.MapNetworkDrive strDriveLetter3, strRemotePath3

'Extra code just to add a message box
WScript.Echo "Map drives " & strDriveLetter1 & " & " & strDriveLetter2 & " & " & strDriveLetter3

Wscript.Quit

它说的问题是第1行Char 1。任何想法?

一个可能的问题是你的文件是如何编码的?尝试将其保存为ANSI并再次运行。
http://stackoverflow.com/questions/2039104/vbscript-invalid-character-800a0408-compilation-error

本站文章除注明转载外,均为本站原创或编译
转载请明显位置注明出处:VBScript无效字符800A0408编译错误