Board logo

标题: 请vbs高手分析这段代码错在哪里?? [打印本页]

作者: stornager     时间: 2007-5-8 23:16    标题: 请vbs高手分析这段代码错在哪里??
Set WshShell=CreateObject("Wscript.Shell")
Intnum=Inputbox("Please enter a number: ")
If Intnum=>6 Then
WshShell.Run "cmd.exe"
Wscript.Sleep 6000
Elseif Intnum=>1 and Intnum<6 Then
WshShell.Run "iexplorer.exe"
Wscript.End

为何运行时脚本提示最后一句缺少`end`
本人正在学习vbs,让高手见笑啦!!

作者: baomaboy     时间: 2007-5-8 23:38

Set WshShell=CreateObject("Wscript.Shell")
Intnum=Inputbox("Please enter a number: ")
If Intnum=>6 Then
WshShell.Run "cmd.exe"
Wscript.Sleep 6000
Elseif Intnum=>1 and Intnum<6 Then
WshShell.Run "iexplorer.exe"
End if

作者: lxmxn     时间: 2007-5-8 23:39

Set WshShell=CreateObject("Wscript.Shell")
Intnum=Inputbox("Please enter a number: ")
If Intnum=>6 Then
WshShell.Run "cmd.exe"
Wscript.Sleep 6000
Elseif Intnum=>1 and Intnum<6 Then
WshShell.Run "iexplorer.exe"
Wscript.Quit(0)
End if

没有Wscript.End的用法。

作者: stornager     时间: 2007-5-9 14:51
谢谢二位指教。本人实在疏忽,在vbs中if......else循环语句必须要有endif作结束标记。刚学没多久,就昏头了。哎!!!!!