VBS案例陈述失败

时间:2013-12-23 16:36:42

标签: vbscript case

这个案例陈述失败了...就像它从来没有看到任何帮助将不胜感激。

Dim Runmode

Set objFileToRead = CreateObject("Scripting.FileSystemObject").OpenTextFile("D:\Program Files (x86)\Logility\SPC8.0\Input\FG352F.txt",1)
RunMode = objFileToRead.ReadAll()
objFileToRead.Close
Set objFileToRead = Nothing
MsgBox(RunMode)


select Case RunMode
  Case "D"
     Set oShell = CreateObject("WSCript.shell")
     oShell.run "D:\Scripts\RTL_DAILY.bat"

  Case "W"
     Set oShell = WScript.CreateObject("WSCript.shell")
     oShell.run "D:\Scripts\RTL_WEEKLY.bat"

  Case "M"
     Set oShell = WScript.CreateObject("WSCript.shell")
     oShell.run "D:\Scripts\RTL_MONTHLY.bat"
End Select

1 个答案:

答案 0 :(得分:2)

假设文件包含单个字母,如“M”和EOL,请使用.ReadLine()自动删除EOL。

一般情况下,抓住(和转储)意外的案例总是一个好主意。