我正在尝试使用GoTo命令(我不知道有任何替代方法,它在批处理中运行良好)。每当我试图加载程序时,我都会得到这样的错误:

这里基本上就是错误所在(第11行,第3列)
top:
input = InputBox("Enter normal text:", "Message Encrypt Style 2", "Text goes here")
If input = "" Then
Y = MsgBox("You inputed nothing!", vbRetryCancel+64, "Huh?")
If Y = 2 Then
WScript.Quit
Else
If Y = 4 Then
GoTo top
Else
If input = 2 Then
WScript.Quit发布于 2017-04-19 15:59:22
VBScript没有Goto语句,而且还有一种更简洁的方法。
Do
input = InputBox(...)
If IsEmpty(input) Or input = "2" Then
WScript.Quit
ElseIf input = "" Then
MsgBox "No input."
End If
Loop Until input <> ""发布于 2017-04-19 08:53:29
尝尝这个
Option Explicit
Dim Input ' as string
Dim Y ' as msgbox response
Input = ""
Do Until Input <> ""
Input= InputBox("Enter normal text:", "Message Encrypt Style 2", "Text goes here")
If Input = "" Then
Y = Msgbox ("You input nothing", vbRetryCancel, "Huh?")
If Y = vbCancel Then
WScript.Quit
End If
ElseIf Input = "2" Then
WScript.Quit
End If
Loop
' Proceed here if input is valid发布于 2018-06-21 20:43:55
Vbscript是一种结构化编程语言,结构化编程的主要目标之一是消除goto语句的considered harmful。Vbscript确实有一个用于异常的goto,但这些只用于在程序退出之前的资源清理。
https://stackoverflow.com/questions/43483302
复制相似问题