代码之家  ›  专栏  ›  技术社区  ›  sb2

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

  •  -1
  • sb2  · 技术社区  · 8 年前

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

    2 回复  |  直到 8 年前
        1
  •  2
  •   Hackoo    8 年前

    拍摄此代码:

    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()
    
        2
  •  2
  •   bfl    8 年前

    您可以使用此选项:

    response = MsgBox("Would you like to open Internet Explorer?", vbYesNo)
    
    If response = vbYes Then
        WScript.CreateObject("WScript.Shell").Run("iexplore")
    End If