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-02 14:14
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to terminate system processes View 1,574 Replies 6
Original Poster Posted 2006-11-06 22:38 ·  中国 广东 佛山 顺德区 电信
初级用户
Credits 52
Posts 20
Joined 2006-11-04 23:06
19-year member
UID 69588
Gender Male
Status Offline
I'm a new newbie, and I want to ask two questions:
1. How to use BAT to terminate system processes. Can it be batch processed when not knowing the process name (for example, only knowing that the process contains the letter Q)?
2. I wrote a BAT that calls a certain EXE, but if this EXE is not closed, the black box of the BAT will always be there. Can the BAT window be closed while calling the EXE?
Thank you, great gods!
Floor 2 Posted 2006-11-07 01:47 ·  中国 广东 佛山 广东睿江科技有限公司
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
You asked two irrelevant questions in this post. It is suggested to split them into two posts. First, it is conducive to future retrieval, second, it is convenient for layout management, third, it can also earn some points, he he.

  1、You said you don't know the process name. According to the general understanding, you don't even know which process you want to terminate, so the bat is even more impossible to know what you want to do. It is estimated that you want to terminate a certain program, but you don't know what the process name corresponding to this program is, right?

  2、Wait until you finish splitting, and then answer in the new post.
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 3 Posted 2006-11-07 03:05 ·  中国 广东 佛山 顺德区 电信
初级用户
Credits 52
Posts 20
Joined 2006-11-04 23:06
19-year member
UID 69588
Gender Male
Status Offline
Yes, I'll split the post immediately!
Floor 4 Posted 2006-11-07 03:10 ·  中国 广东 佛山 顺德区 电信
初级用户
Credits 52
Posts 20
Joined 2006-11-04 23:06
19-year member
UID 69588
Gender Male
Status Offline
Originally posted by namejm at 2006-11-6 01:47 PM:
  Your post actually asks two unrelated questions. It is recommended to split it into two posts for questioning. First, it is beneficial for future retrieval. Second, it is convenient for board management. Third, it can also earn some points. Hehe...

I think you have a bit of a misunderstanding. I mean, knowing that the process name contains certain common letters (such as containing Q), can these processes be closed in batches?
Floor 5 Posted 2006-11-07 05:14 ·  中国 广东 清远 联通
高级用户
★★
Credits 846
Posts 247
Joined 2006-10-27 12:03
19-year member
UID 68504
Gender Male
From 湖南==》广东
Status Offline
For the XP system, you can simply use the following method:
@for /f %%i in ('tasklist /NH ^|find /I "NOTE"') do @taskkill /IM %%i /T
Description: NOTE is the text included in the process you want to end. For the 2000 system, use WMI
Floor 6 Posted 2006-12-01 08:30 ·  中国 上海 浦东新区 电信
新手上路
Credits 6
Posts 3
Joined 2006-12-01 01:59
19-year member
UID 72210
Gender Male
Status Offline
Q: How to close a process that cannot be closed with the Task Manager?

A1:
Killing a process is very easy, any tool will do. For example, IceSword. The key is to find the startup method of this process, otherwise it will come out again after the next restart. By the way, teach you a tough trick. In fact, most processes can be killed with Windows built-in tools:

  c:\>ntsd -c q -p PID

  Only System, SMSS.EXE and CSRSS.EXE cannot be killed. The first two are purely kernel-mode, and the last one is the Win32 subsystem, and ntsd itself needs it. Ntsd has been a user-mode debugging tool built into the system since 2000. A process attached by a debugger will exit with the debugger, so it can be used to terminate the process from the command line. Ntsd automatically obtains debug permissions, so it can kill most processes. Ntsd will open a new debugging window. Originally, it cannot be controlled in the pure command line, but if it is just a simple command, such as exit (q), it can be passed from the command line with the -c parameter. Ntsd is also provided to software developers as usual. Only system developers use this command. For more information, see the help file attached in NTSD. Usage: Open a cmd.exe window and enter:

  ntsd -c q -p PID

  Change the last PID to the ID of the process you want to terminate. If you don't know the process ID, Task Manager -> Processes tab -> View -> Select Columns -> Check "PID (Process Identifier)", then you can see it.

A2:
Under XP, there are two more good things, tasklist and tskill. tasklist can list all processes and corresponding information. tskill can kill processes. The syntax is very simple: tskill program name!!
Floor 7 Posted 2006-12-01 08:34 ·  中国 甘肃 兰州 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
1 It's possible, but it will definitely crash.

2 start *.exe
Forum Jump: