當我我得到了在服務器上運行我的腳本時:預計聲明「預期聲明」運行的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