[英]How can I make it echo 'That's good' and 'Why not?' if 'Yes' and 'No' are selected respectively?
MsgBox "Are you fine?", vbYesNo, "Greeting"
K% = MsgBox "Are you fine?", vbYesNo, "Greeting"
Select Case K%
Case vbYes
WScript.Echo "That's good."
Case vbNo
WScript.Echo "Why not?"
End Select
I use the above script in a .vbs file to bring up a message box with 'Yes' and 'No' buttons. 我在.vbs文件中使用以上脚本来显示带有“是”和“否”按钮的消息框。 I want it to echo 'That's good' and 'Why not?' 我希望它回显“很好”和“为什么不呢?” if 'Yes' and 'No' are selected respectively. 如果分别选择“是”和“否”。 However, it does not work. 但是,它不起作用。 Can anyone tell me what is wrong with it? 谁能告诉我这是怎么回事?
A few things aren't right: 有几件事情是不对的:
%
sign. 变量名称不能包含%
符号。 Rename it to something else. 将其重命名为其他名称。 MsgBox("Are you fine", vbYesNo, "Greeting")
调用msgbox时缺少括号: MsgBox("Are you fine", vbYesNo, "Greeting")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.