如何在没有给出条目的情况下结束vbs文件
问题描述:
如果未输入密码,我将如何结束vbs文件,如果单击“好”,它将继续。 如果没有输入任何内容,我希望它结束。 是可能的吗?如何在没有给出条目的情况下结束vbs文件
If InputBox("Please enter the passcode.", "Restricted access") = "Passcode" Then MsgBox "Correct passcode. You may continue.
Dim speaks, speech
name=inputbox("What's your name?", "WELCOME")
speaks=("Welcome ") + name
Set speech=CreateObject("sapi.spvoice")
speech.Speak speaks
答
你的意思是这样的吗?
Dim strPassword As String
strPassword = InputBox("Please enter the passcode.", "Restricted access") & ""
If strPassword = "Passcode" then
MsgBox "Correct passcode. You may continue."
Dim speaks, speech
name=inputbox("What's your name?", "WELCOME")
speaks=("Welcome ") + name
Set speech=CreateObject("sapi.spvoice")
speech.Speak speaks
else
WScript.Quit
endif
+2
'Dim strPassword As String'不是VBScript;问题是如何检查空输入/取消。 –
请参阅'https://stackoverflow.com/a/20539978/6038551'。我假设你知道'WScript.Quit'。 –