以我的以下脚本为例:
x=msgbox ("Do you want to recycle the Premiere Pro Media Cache?" ,4, "Recycle Premiere Pro Media Cache")
If box =6 Then
CreateObject("wscript.shell").run "C:\Expedited\Scripts\PrMCRecycler1"
End If我的目标是让这个VBS文件(弹出一个消息框)在按下yes按钮时运行批处理文件(与双击批处理文件时的运行方式相同)。我不确定我在上面做错了什么。当我单击No时,不需要发生任何事情,所以我没有为它指定任何内容。
基本上,因为它会弹出一个yes/no消息框,所以我只需要让yes按钮执行指定的批处理文件。我真的需要一些帮助来找出问题所在。当我尝试上面列出的代码时,选择yes时没有任何反应(除了对话框消失之外)。
发布于 2015-02-17 15:23:51
尝试此示例并更改批处理文件的路径。
Option Explicit
Dim ws,Question,PathProgram
Set ws = CreateObject("wscript.shell")
'change the path of your batch file
PathProgram = "C:\Program Files\Internet Explorer\iexplore.exe"
Question = Msgbox("Do you want to recycle the Premiere Pro Media Cache?",VbYesNO + VbQuestion, "Recycle Premiere Pro Media Cache")
If Question = VbYes Then
ws.run DblQuote(PathProgram)
End If
'***************************************
Function DblQuote(Str)
DblQuote = Chr(34) & Str & Chr(34)
End Function
'***************************************https://stackoverflow.com/questions/28553635
复制相似问题