Vbs脚本在消息框上打开程序

时间:2018-03-13 21:22:28

标签: vbscript

我需要一个带有消息框的vbs脚本,当我单击是时打开iexplorer,当我单击否时关闭msg框。谢谢,我是编程新手,需要帮助。谢谢。

2 个答案:

答案 0 :(得分:1)

您可以使用:

response = MsgBox("Would you like to open Internet Explorer?", vbYesNo)

If response = vbYes Then
    WScript.CreateObject("WScript.Shell").Run("iexplore")
End If

答案 1 :(得分:1)

为此代码拍摄:

Option Explicit
Dim Title,Answer,ws,Site
Site = "https://stackoverflow.com/"
Title = "Open iexplore.exe"
Answer = MsgBox("Did you want to open iexplore.exe ?",VbQuestion+VbYesNo,Title)
If Answer = vbYes Then
    set ws = CreateObject("wscript.shell")
    ws.run("iexplore.exe" &" "& Site)
End If
Wscript.Quit()