Close an application using VBScript

后端 未结 5 1629
南旧
南旧 2020-12-10 08:10

I was trying to open and close an application. I tried like this:

Dim App1 
Set App1 = CreateObject(\"WScript.Shell\")
App1.Run(\"firefox\")
App1.Quit
         


        
5条回答
  •  -上瘾入骨i
    2020-12-10 09:15

    If you want to be able to terminate a process that way you need to use the Exec method instead of the Run method.

    Set ff = CreateObject("WScript.Shell").Exec("firefox")
    'you do stuff
    ff.Terminate
    

提交回复
热议问题