当我在服务器上运行脚本时,我得到:期望的声明
我的代码
if STATUS = "ERROR" then
ext = LCase(FSO.GetExtensionName(sNewestFile))
' ZIP and RAR handler
' What should it do of the ext variable is zip or Rar?
' it is specified in the cases.
Select Case ext
Case "log", "txt"
'Runs the tail.exe file to get the last 10 lines of text in the [sNewestFile] and insert them to the log file.
'This will only be done IF there is a status = "ERROR"
errorStr = WScript.CreateObject("WScript.Shell").Exec( _ "tail -n 10 """ & sNewestFile & """" _ ).StdOut.ReadAll
objLogFile.writeline "" & vbCrLf
objLogFile.writeline "Error Message Start" & vbCrLf
objLogFile.writeline "" & errorStr & vbCrLf
objLogFile.writeline "Error Message End"
Case "zip"
objLogFile.writeline "" & vbCrLf
objLogFile.writeline "The Date of the ZIP file is to old" & vbCrLf
Case "rar"
objLogFile.writeline "" & vbCrLf
objLogFile.writeline "The Date of the RAR file is to old" & vbCrLf
End Select 'Ends the Select Case ext
End If
问题是我不断得到一些错误,首先是无效字符我通过做一个探测器if语句解决了这个问题。现在是预期声明。
我似乎无法弄清楚哪里出错了?
我使用以下内容作为参考:
答案 0 :(得分:1)
显然解决方案是使用:
errorStr = WScript.CreateObject("WScript.Shell").Exec( _
"tail -n 10 """ & sNewestFile & """" _
).StdOut.ReadAll
而不是1行:
errorStr = WScript.CreateObject("WScript.Shell").Exec( _ "tail -n 10 """ & sNewestFile & """" _ ).StdOut.ReadAll
为什么这是我必须提供的线索。