我正在使用VBScript进行编程,我只是抓住了ReturnValue = MsgBox("Content", 36, "Title")
,我想按下是按钮关闭我的代码,但是当你按下时打开一个应用程序否按钮。
到目前为止,这是代码:
ReturnValue = MsgBox("Content", 36, "Title")
If ReturnValue = 7 Then
Set WSHShell = WScript.CreateObject("WScript.Shell")
WSHShell.run "open this.exe"
End If
If ReturnValue = 6 Then
WScript.Quit
End If
答案 0 :(得分:0)
您的脚本似乎正常工作。这里只需稍作修改即可使功能更加明显:
ReturnValue = MsgBox("Click yes to exit." + vbCrlf + "Click no to open Notepad.", 36, "Exit Script?")
If ReturnValue = 7 Then
Set WSHShell = WScript.CreateObject("WScript.Shell")
WSHShell.run "notepad.exe"
End If
If ReturnValue = 6 Then
MsgBox "Script is now exiting"
WScript.Quit
End If
如果您遇到其他行为,请告诉我们它是什么。
以下是MsgBox
命令的完整文档:http://ss64.com/vb/msgbox.html