中国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-12 05:05
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » [Organize] Batch processing to detect whether a process exists and take a predetermined action.
Printable Version  3,107 / 13
Floor1 zuimeng Posted 2008-02-29 15:15
初级用户 Posts 83 Credits 170
Detect if a process exists and take a predefined action.
http://www.cn-dos.net/forum/viewthread.php?tid=38018

------------Second-----------




Check if there is a QQ.EXE process on the computer, and if so, automatically end it
http://www.cn-dos.net/forum/viewthread.php?tid=37918

a) First, use tasklist to input the process list to find, let find find the qq.exe process. If found, then perform the following end operation; if not found, exit the bat



b) Put the process list in document A and then use the FIND search code:



c) If it is not a cyclic monitoring, directly taskkill... Anyway, the final purpose is to not have the QQ process.


Automatically detect the process list every 20 seconds and automatically close notepad.exe.
http://www.cn-dos.net/forum/viewthread.php?tid=22267




Detect explorer.exe process
http://www.cn-dos.net/forum/viewthread.php?tid=36526
Detect the explorer.exe process. If this process is found, exit; if not, copy one from the E drive to the system directory and then run it.
My system often can't enter, and I find that the explorer.exe file is deleted by the virus.




Detect the running of a process every 30 seconds, and if it does not exist, restart the computer.
http://www.cn-dos.net/forum/viewthread.php?tid=31759




Script to detect whether a process of the system exists. If it does not exist, automatically shut down.
http://www.cn-dos.net/forum/viewthread.php?tid=22861



But this only detects once when this bat runs, not real-time monitoring

Use Goto statement to do monitoring



In this way, if the Explorer.exe process exists, it is an infinite loop.
Until the Explorer.exe process ends, the shutdown command is executed.
But this has a disadvantage of 100% CPU


Detect multiple specific processes
http://www.cn-dos.net/forum/viewthread.php?tid=27743
I want to implement such a function: list the current process list with tasklist, then use find to search whether the process contains 1.exe, 2.exe, 3.exe... (assuming). If one of them is in the list, perform a certain operation. I want to use FOR to implement the loop but can't get it to work. This is how I tried:
tasklist | for %%j in (1.exe,2.exe,3.exe) do find "%%j" && goto :p
Can't find use for? Please give pointers.
---------

for will not accept the data passed from tasklist, it is defined by in
---------
---------


Detection and exit process problem
http://www.cn-dos.net/forum/viewthread.php?tid=25357
Processes A and B exist. If A does not exist, exit B. Detect every N seconds in a loop. After exiting B, exit the program



List the currently running processes, can customize the description content, manually close the process.
Can be improved to automatically judge and process the process.
http://www.cn-dos.net/forum/viewthread.php?tid=27405




http://www.loverat.cn/topic.asp?TOPIC_ID=1211
Floor2 tuliangwl Posted 2008-03-01 02:47
初级用户 Posts 28 Credits 55
Floor3 ldk7625 Posted 2008-03-01 19:19
新手上路 Posts 4 Credits 7
Learned something, thanks.
Floor4 moniuming Posted 2008-03-01 20:57
银牌会员 Posts 574 Credits 1,335 From 广西
Good stuff, but, really don't want people with bad intentions to see this post
Floor5 nnydkj Posted 2008-03-02 02:34
新手上路 Posts 5 Credits 10
Newcomer reporting, come in and learn~
Floor6 suntb Posted 2008-03-04 17:10
高级用户 Posts 277 Credits 581
This thing is powerful, a bit scary
Floor7 hxwxyz Posted 2008-03-04 22:41
中级用户 Posts 123 Credits 245
Learning
Floor8 luckydjc Posted 2008-03-06 14:38
新手上路 Posts 2 Credits 4
This thing is pretty good....
Get it down and learn it slowly...
Floor9 Kinglion Posted 2008-03-06 14:59
铂金会员 Posts 1,924 Credits 5,798 From 金獅電腦軟體工作室
Floor10 pizigao Posted 2009-05-27 01:29
银牌会员 Posts 292 Credits 1,063
Floor11 Hanyeguxing Posted 2009-05-27 13:29
银牌会员 Posts 897 Credits 1,039 From 在地狱中仰望天堂
Add a little something for the thread starter:
For starting explorer.exe, it is recommended to use "start explorer.exe"
Otherwise, the batch window cannot be automatically closed
Floor12 renchmin Posted 2009-05-27 21:41
新手上路 Posts 9 Credits 16
This post is very practical, support the original poster.
Floor13 dqls889 Posted 2009-05-28 08:19
初级用户 Posts 36 Credits 68
Learning.
Floor14 lcleft Posted 2009-06-05 01:52
社区乞丐 Posts 32 Credits -31
Can't understand it, it's like天书
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023