当我我得到了在服务器上运行我的脚本时:预计声明“预期声明”运行的VBScript
我的代码
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
的事情是,我不断收到somekind的错误的第一它是无效字符我解决了这个问题,通过做一个探测器如果语句。现在它的一个预期声明。
我只是不知道该怎么弄出来,它出错了?
我用于引用如下:
- http://www.tizag.com/vbscriptTutorial/vbscriptelseif.php
- http://www.tizag.com/vbscriptTutorial/vbscriptselectcase.php
- https://stackoverflow.com/a/1604488/3430698
- https://stackoverflow.com/a/32397175/3430698
如果select语句中没有'Case Else',这个错误会发生吗? – Jesper