China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-07 16:25
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Help] How to detect whether there is a specified process and perform corresponding operations on it? View 1,562 Replies 7
Original Poster Posted 2008-02-24 19:42 ·  中国 江西 吉安 电信
初级用户
Credits 97
Posts 34
Joined 2007-11-16 16:04
18-year member
UID 102852
Gender Male
Status Offline

─────────────────── Moderation Record ────────────────────
Performed by: bjsh
Title: Please teach me how to write this batch script??
Description: The title is too vague, which is not convenient for forum search and management. Please modify the title within three days, otherwise 2 points of points will be deducted
Reference: http://www.cn-dos.net/forum/viewthread.php?tid=7326&fpage=1
   http://www.cn-dos.net/forum/viewthread.php?tid=1415
─────────────────── Moderation Record ────────────────────

Check if there is a QQ.EXE process in the computer. If there is, automatically end it
I wrote it like this, but it doesn't work. Please ask experts for guidance
@echo off
tasklist > a.txt
type a.txt | find "QQ.EXE" && taskkill /im "QQ.EXE"
pause
exit

[ Last edited by lxmxn on 2008-2-26 at 01:27 AM ]
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
lxmxn -2 2008-02-26 01:26
Floor 2 Posted 2008-02-24 20:07 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
tasklist | find /i "QQ.EXE" &&taskkill /f /im QQ.EXE
第一高手 第二高手

Floor 3 Posted 2008-02-24 20:17 ·  中国 重庆 电信
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
(tasklist /nh /fi "imagename eq QQ.exe"|findstr /i "QQ.exe")&&(taskkill /f /im "QQ.exe")
Floor 4 Posted 2008-02-24 22:36 ·  中国 山东 潍坊 电信
中级用户
★★
Credits 201
Posts 75
Joined 2007-02-24 00:26
19-year member
UID 80034
Gender Male
Status Offline
wmic process where name='QQ.exe' delete
Floor 5 Posted 2008-02-24 22:46 ·  中国 广东 佛山 南海区 电信
初级用户
★★
Credits 131
Posts 72
Joined 2008-02-24 14:31
18-year member
UID 111317
Gender Male
Status Offline
@echo off
tasklist|find /i "qq.exe" ||exit
taskkill /im qq.exe /f
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
Floor 6 Posted 2008-02-25 10:36 ·  中国 江西 吉安 电信
初级用户
Credits 97
Posts 34
Joined 2007-11-16 16:04
18-year member
UID 102852
Gender Male
Status Offline
Thanks, but why is it not working when I put the process list in document A and then use FIND to search? Could it be because of the lack of the /I option to ignore case? I want to know, please guide me.
Floor 7 Posted 2008-02-25 13:36 ·  中国 上海 联通
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
Originally posted by jy02141405 at 2008-2-25 10:36 AM:
Thanks, but why does it not work when I put the process list in document A and then use FIND to search?
Could it be because of the lack of the /I option to ignore case? I want to know, please guide me

@echo off
tasklist>C:\a.txt
find "QQ.exe" C:\a.txt&&taskkill /f /im "QQ.exe"
Floor 8 Posted 2008-02-25 14:08 ·  中国 陕西 西安 电信
铂金会员
★★★★
Credits 5,212
Posts 2,478
Joined 2007-02-08 23:39
19-year member
UID 79003
Gender Male
Status Offline
If it's not for cyclic monitoring, just use taskkill... Anyway, the ultimate goal is to have no QQ processes.
Forum Jump: