如何使用BATCH或CMD关闭特定窗口?

时间:2014-03-07 16:14:35

标签: batch-file cmd

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

示例:我打开了许多现有窗口,并在Windows 7中打开“我的电脑”。如何使用批处理脚本关闭它?

也尝试回答How to copy an .exe or any type of file which is hiiden using BATCH FILE? !!

1 个答案:

答案 0 :(得分:0)

也许使用SendKeys。将以下内容另存为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