0
請問您可以告訴下面的VBScript有什麼問題嗎?我得到這個錯誤:error expected ')'
在Windows上運行.vbs時出現錯誤,預計')'vb腳本
的VBScript:
Const strSourceFile = "C:\Temp\test.txt"
Const strTargetFile = "C:\Temp\test.csv"
Dim strData
Dim objFSO, objSourceFile, objTargetFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objSourceFile = objFSO.OpenTextFile(strSourceFile, 1, True)
Set objTargetFile = objFSO.CreateTextFile(strTargetFile, True)
Do While Not objSourceFile.AtEndOfStream
strData = objSourceFile.ReadLine
'msgbox strData
Dim strName, strAddress, strCity, strState, strZip
strName = Trim(Mid(strData, 1, 20))
strAddress = Trim(Mid(strData, 21, 20))
strCity = Trim(Mid(strData, 41, 20))
strState = Trim(Mid(strData, 61, 2))
strZip = Trim(Mid(strData, 63 5))
objTargetFile.WriteLine("""" & strName & """,""" & strAddress & """,""" & strCity & """,""" & strState & """,""" & strZip & """")
Loop
msgbox "done!"
謝謝托馬斯!感謝你的幫助! – user3276905