使用 VBScript 关闭应用程序 [英] Close an application using VBScript

查看:43
本文介绍了使用 VBScript 关闭应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图打开和关闭应用程序.我试过这样:

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

Firefox 会打开,但不会关闭.

Firefox will open, but it will not close.

错误信息:

对象不支持此属性或方法

object doesn't support this property or method

我提到了 InDesign Scripting 如何退出应用程序(不是文档)

请告诉我关闭应用程序的程序.

Please tell me the procedure to close the application.

推荐答案

如果您希望能够以这种方式终止进程,您需要使用 Exec 方法而不是 Run 方法.

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

这篇关于使用 VBScript 关闭应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆