如果没有给出条目,你如何结束vbs文件

时间:2017-10-17 11:12:38

标签: vbscript

如果未输入密码,我将如何结束vbs文件,如果单击“Okay”,它将继续。 如果没有输入,我想要结束。 那可能吗?

    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

1 个答案:

答案 0 :(得分:-1)

你的意思是什么?

    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