如何关闭特定窗口使用批处理或CMD? [英] how to close a particular window using BATCH or CMD?

查看:1976
本文介绍了如何关闭特定窗口使用批处理或CMD?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何使用批处理脚本关闭一个特定的窗口?

How do I close a particular window using a batch script?

?例如:我有很多现有窗口打开,而我在Windows 7中打开我的电脑我怎么可以关闭此使用批处理脚本

Example: I have many existing windows open, and I open "My Computer" in Windows 7. How can I close this using a batch script?

也尝试回答<一个href=\"http://stackoverflow.com/questions/22254645/how-to-start-an-exe-or-any-type-of-file-which-is-hiiden-using-batch-file\">How启动一个.exe或使用批处理文件hiiden任何类型的文件?过!

推荐答案

也许使用的SendKeys。以下内容作为 Closer.vbs

Maybe using SendKeys. Save the following as Closer.vbs:

set shell = createobject("wscript.shell")
rcSuccess = shell.AppActivate("title of window to activate")
if rcSuccess = 1 then shell.sendkeys "%{F4}"

然后,让所谓的批处理文件 CloseApp.BAT 包含

REM Close some App
cscript /nologo closer.vbs

和运行使用:

CloseApp

这篇关于如何关闭特定窗口使用批处理或CMD?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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