中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-06 09:21
48,039 topics / 350,124 posts / today 0 new / 48,251 members
DOS批处理 & 脚本技术(批处理室) » [Help] How to automatically detect a process
Printable Version  1,199 / 8
Floor1 08765976 Posted 2007-07-08 07:33
初级用户 Posts 11 Credits 26
Guys, please help me write a batch file or VB script.
I want it so that as soon as it fails to detect a process, for example, as soon as it fails to detect the QQ.exe process, it will immediately reboot the computer. I don't know if any of you guys have a way to help me get this done.
Floor2 08765976 Posted 2007-07-08 08:38
初级用户 Posts 11 Credits 26
Could it be that nobody will help me? *crying*~
Floor3 zerocq Posted 2007-07-08 15:45
中级用户 Posts 196 Credits 458
Floor4 tclgb Posted 2007-07-08 17:44
初级用户 Posts 26 Credits 76
@echo off
@echo tasklist^|find /i "QQ.exe"^|^|shutdown -r -t 30>c:\bb.bat
@schtasks /create /sc minute /mo 30 /tn "findQQ" /tr c:\bb.bat /ru ""
@net start schedule

The idea in the second line borrows from brother zerocq.
The purpose of the third line is to add it to Scheduled Tasks, to run once every half hour,
what comes after /tn is the task name
what comes after /tr is the program path
/ru "" means to run under the System account

[ Last edited by tclgb on 2007-7-9 at 10:35 PM ]
Floor5 qinbuer Posted 2007-07-08 23:04
高级用户 Posts 228 Credits 512
Actually there's no need to specify the QQ path

@echo off
echo wmic process where name="QQ.exe" call terminate >c:\bb.bat
schtasks /create /sc minute /mo 30 /tn "findQQ" /tr c:\bb.bat /ru ""

[ Last edited by qinbuer on 2007-7-8 at 11:05 PM ]
Floor6 08765976 Posted 2007-07-09 19:54
初级用户 Posts 11 Credits 26
Guys, it doesn't seem to work. Can you help take another look?
Floor7 08765976 Posted 2007-07-09 19:55
初级用户 Posts 11 Credits 26
Brother, it doesn't seem to work. Can you help me take a look?
Floor8 qinbuer Posted 2007-07-09 20:05
高级用户 Posts 228 Credits 512
If the Task Scheduler service isn't running, then although the task can be created, it still can't run. You can

run services.msc and check whether the Task Scheduler service has started.
Floor9 yuanye002 Posted 2007-11-07 12:43
初级用户 Posts 25 Credits 44
Thanks, I just happened to be testing a script like this.
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023