标题: 用批处理命令关闭指定窗口?
[打印本页]
作者: qwphigh
时间: 2008-7-21 12:21
标题: 用批处理命令关闭指定窗口?
用批处理命令关闭指定窗口?
各位大虾帮帮小弟!:(
作者: abcd
时间: 2008-7-21 12:36
不可以
作者: qwphigh
时间: 2008-7-21 12:50
哦,谢谢
作者: pooronce
时间: 2008-7-21 13:06
如果指定窗口是某程序且是名字唯一的话,可以直接taskkill
taskkill /F /IM iexplore.exe
作者: HAT
时间: 2008-7-21 14:15
@echo off
rem 假设要关闭窗口标题为a.txt的记事本文件
set tilname=a.txt
for /f "tokens=2" %%a in ('tasklist /fi "imagename eq notepad.exe" /v ^| findstr /i "%tilname%"') do taskkill /pid %%a
作者: yishanju
时间: 2008-7-22 17:03
Quote: |
Originally posted by HAT at 2008-7-21 14:15:
[code]@echo off
rem 假设要关闭窗口标题为a.txt的记事本文件
set tilname=a.txt
for /f "tokens=2" %%a in ('tasklist /fi "imagename eq notepad.exe" /v ^| findstr / ... |
|

如果我是用写字板打开A.TXT文件的呢
作者: quya
时间: 2008-7-22 17:59
关闭窗口标题为a.txt的记事本文件 taskkill /fi "imagename eq notepad.exe" /fi "windowtitle a*"
关闭窗口标题为a.txt的写字板文件 taskkill /fi "imagename eq wordpad.exe" /fi "windowtitle a*"
假如能确定窗口标题比较特殊而且唯一, 比如jhfjfjjfj, 那么可以直接
taskkill /fi "windowtitle jhfjfjjfj*"
在上面最初的2个例子却不能 taskkill /fi "windowtitle a*", 因为以a开头的程序太多了, 有时候的窗口标题是隐藏的, 比如以a开头的窗口标题就有ATI显卡的驱动程序等.
作者: recallshan
时间: 2008-7-22 22:20
批处理好像无法达到获取窗口的相关字符
记的有个病毒病毒屏蔽杀毒软件等相关字眼 但当然是非BAT了