标题: [系统相关] 批处理怎样选择运行? [打印本页]
作者: zcdyj 时间: 2011-5-3 20:31 标题: 批处理怎样选择运行?
本帖最后由 zcdyj 于 2011-5-3 21:48 编辑
例如我用这条命令tasklist /nh|find /i "taskmgr.exe"
检测taskmgr.exe进程是否存在,如果存在则继续运行tasklist /nh|find /i "taskmgr.exe"
如果不存在时则运行wmic process where (name like '%%qq%%') delete
请教这个的批处理该怎么写?
不知道为什么这样不成功啊- if exist tasklist /nh|find /i "taskmgr.exe" (
- tasklist /nh|find /i "taskmgr.exe"
- ) else (
- wmic process where (name like '%%qq%%') delete
- )
- pause
复制代码
就是检测到有taskmgr.exe再循环检测 检测不到则运行 wmic process where (name like '%%qq%%') delete 这样如何实现?
作者: hanyeguxing 时间: 2011-5-3 20:43
- tasklist /nh|find /i "taskmgr.exe">nul 2>nul&&echo;有||echo;无
复制代码
作者: Batcher 时间: 2011-5-3 20:51
你看看教程里面if exist有那功能么?
http://bbs.bathome.net/thread-2530-1-1.html
作者: zcdyj 时间: 2011-5-3 21:22
2# hanyeguxing
感谢版主 我的意思是检测到有taskmgr.exe再循环检测 检测不到则运行 wmic process where (name like '%%qq%%') delete 这样如何实现?
作者: zcdyj 时间: 2011-5-3 21:43
我看了 的确是没这功能.....
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |