Close an application using VBScript

后端 未结 5 1636
南旧
南旧 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条回答
  •  情话喂你
    2020-12-10 08:51

    Firefox is not a COM object. There is no Firefox COM object. Firefox does not want you to use COM. Or NET. Or Microsoft. That is why you could not create a Firefox object, so you created a WScript.Shell object instead.

    WScript.Shell does not have a quit method. If it did, it wouldn't help kill Firefox.

    This is an example of using WMI from VBS to start, then kill a process like Firefox.

提交回复
热议问题