|
tempuser
高级用户
   
积分 547
发帖 261
注册 2006-4-15
状态 离线
|
『楼 主』:
[求助]ntsd关闭进程的问题?
使用 LLM 解释/回答一下
ntsd关闭进程的问题?
1,假设notepad.exe的PID是2328,我现在在DOS下执行以下命令是成功的:
ntsd -c q -p 2328
但我在批处理这样运用它,却失败了:
@echo off
set /p closeprocess= 请输入你要强制关闭的进程PID
ntsd -c q -p "%closeprocess%"
goto :eof
错误提示如下:
Unable to find process '2328', HRESULT 0x80004002
"不支持此接口"
ntsd: exiting - press enter ---
为什么?
2.另外,请教wmic process delete的具体用法,它的这个delete是否也是强制删除进程的,包括一些系统进程?
在线等待中......
### Question 1:
The problem?
1, Suppose the PID of notepad.exe is 2328, I executed the following command successfully under DOS:
ntsd -c q -p 2328
But when I use it in a batch script like this, it fails:
@echo off
set /p closeprocess= Please enter the PID of the process you want to force close
ntsd -c q -p "%closeprocess%"
goto :eof
The error message is as follows:
Unable to find process '2328', HRESULT 0x80004002
"This interface is not supported"
ntsd: exiting - press enter ---
Why?
2. Also, ask about the specific usage of wmic process delete, is this delete also to force delete the process, including some system processes?
Waiting online......
|
|
2008-10-27 14:40 |
|
|
HAT
版主
       
积分 9023
发帖 5017
注册 2007-5-31
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
@echo off
tasklist|findstr /i "notepad.exe"
echo.
set /p closeprocess=请输入你要强制关闭的进程PID
ntsd -c q -p %closeprocess%
```
@echo off
tasklist|findstr /i "notepad.exe"
echo.
set /p closeprocess=Please enter the PID of the process you want to force close
ntsd -c q -p %closeprocess%
```
|

 |
|
2008-10-27 14:59 |
|
|
tempuser
高级用户
   
积分 547
发帖 261
注册 2006-4-15
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
执行后没有出错提示了,但不能关闭进程。
%closeprocess%加"%closeprocess%"没什么影响。
There is no error prompt after execution, but the process cannot be closed. Adding "%closeprocess%" with "%closeprocess%" has no effect.
|
|
2008-10-27 15:37 |
|
|
tempuser
高级用户
   
积分 547
发帖 261
注册 2006-4-15
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
为什么啊!
ntsd在DOS下好使,在批处理中却失败呢?
找了半天,有参数理解的收获,但就是不好使啊!
ntsd -c q -pn
c :command
q :quit
p :pid
n :processname
例:
ntsd -c q -pn notepad.exe
或
ntsd -c q -p 2696
Why is that!
ntsd works well under DOS, but fails in batch processing?
Searched for a long time, got some insights on parameter understanding, but it just doesn't work!
ntsd -c q -pn
c :command
q :quit
p :pid
n :processname
Example:
ntsd -c q -pn notepad.exe
or
ntsd -c q -p 2696
|
|
2008-10-27 17:00 |
|
|
newsuper
新手上路
 坚持学习
积分 18
发帖 15
注册 2008-10-18
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
如果ntsd不行,试试taskkill啊,很好用的
taskkill /pid xxx
一直用这个。
If ntsd doesn't work, try taskkill, it's very useful.
taskkill /pid xxx
Always use this.
|
|
2008-10-27 23:17 |
|
|
HAT
版主
       
积分 9023
发帖 5017
注册 2007-5-31
状态 离线
|
『第 6 楼』:
Re 4楼
使用 LLM 解释/回答一下
@echo off
tasklist|findstr /i "notepad.exe"
echo.
set /p closeprocess=请输入你要强制关闭的进程PID
ntsd -c q -p %closeprocess%
tasklist|findstr /i "notepad.exe"
echo.
能否把你的结果贴出来看看?
这是我的:

@echo off
tasklist|findstr /i "notepad.exe"
echo.
set /p closeprocess=Please enter the PID of the process you want to forcefully close
ntsd -c q -p %closeprocess%
tasklist|findstr /i "notepad.exe"
echo.
Can you post your result for me to see?
This is mine:

|

 |
|
2008-10-27 23:30 |
|
|
slore
铂金会员
      
积分 5212
发帖 2478
注册 2007-2-8
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
用taskkill把ntsd结束掉^
ntsd结束进程有时候ntsd的窗口会停留,关闭才能结束
Use taskkill to end the ntsd process ^
Sometimes when ending the ntsd process, the ntsd window may stay, and you need to close it to end it.
|

S smile 微笑,L love 爱,O optimism 乐观,R relax 放松,E enthusiasm 热情...Slore |
|
2008-10-27 23:47 |
|
|
newsuper
新手上路
 坚持学习
积分 18
发帖 15
注册 2008-10-18
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
好像taskkill 在批处理中也不能用,以前只是在命令行用过。
It seems that taskkill can't be used in batch processing either. I only used it in the command line before.
|
|
2008-10-28 00:22 |
|
|
HAT
版主
       
积分 9023
发帖 5017
注册 2007-5-31
状态 离线
|
『第 9 楼』:
Re 8楼
使用 LLM 解释/回答一下
你听谁说的?还是亲自测试过?能把你的测试代码和结果贴出来看看么?
Who did you hear it from? Or did you personally test it? Can you post your test code and results for us to see?
|

 |
|
2008-10-28 00:32 |
|
|
newsuper
新手上路
 坚持学习
积分 18
发帖 15
注册 2008-10-18
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
不知道是不是电脑出了问题,还是程序有问题。
下面的 taskkill 在for循环批处理里不能使用。
for /f "tokens=1,2" %%i in ('tasklist.exe') do if %%i ==notepad.exe taskkill /pid %%j
但是 如果只有这一条的话:taskkill /im notepad.exe,却可以使用,就是不放在for循环里面。
还有其他的,感觉好像taskkill 不支持变量一样。
还望高人指点。
今天又测试了一下,发现是程序的问题 应该把%%i==notepad.exe 改为"%%i"=="notepad.exe",就是加上引号。
以下是测试程序,很简单的。
@echo off
start /min notepad.exe
for /f "tokens=1,2" %%i in ('tasklist.exe') do if "%%i"=="notepad.exe" echo %%j
set /p cp=请输入你要结束的进程的PID
taskkill /pid %cp%
Last edited by newsuper on 2008-10-28 at 19:10 ]
I don't know if it's a problem with the computer or the program.
The following taskkill cannot be used in the for loop batch processing.
for /f "tokens=1,2" %%i in ('tasklist.exe') do if %%i ==notepad.exe taskkill /pid %%j
But if there is only this one: taskkill /im notepad.exe, it can be used, just not in the for loop.
There are others, it seems like taskkill doesn't support variables.
I hope an expert can give guidance.
Today I tested again and found that it's a problem with the program. It should be change %%i==notepad.exe to "%%i"=="notepad.exe", that is, add quotes.
The following is the test program, very simple.
@echo off
start /min notepad.exe
for /f "tokens=1,2" %%i in ('tasklist.exe') do if "%%i"=="notepad.exe" echo %%j
set /p cp=Please enter the PID of the process you want to end
taskkill /pid %cp%
Last edited by newsuper on 2008-10-28 at 19:10 ]
|
|
2008-10-28 00:54 |
|
|
tempuser
高级用户
   
积分 547
发帖 261
注册 2006-4-15
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
我确实测试了很多遍,我也截了图,到我不会把图传上来,能告诉我怎么做吗?
我试试附件吧!有两个图
I have indeed tested many times, and I also took screenshots, but I don't know how to upload the pictures. Can you tell me how to do it?
I'll try the attachment! There are two pictures
附件
1: 2.JPG (2008-10-28 07:59, 39.8 KiB)
|
|
2008-10-28 07:59 |
|
|
tempuser
高级用户
   
积分 547
发帖 261
注册 2006-4-15
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
第2个,因为一直提示要输入的notepad.exe的PID,没办法,主动关闭了CMD窗口.
再重新进入到CMD下,执行
tasklist | findstr /i "notepad.exe"
看到notepad.exe还在那,没有关闭.我在座测试前运行的一个记事本文件也在任务栏下好好的呆着,根本没有关闭,所以我说ntsd的这段代码不好使.
我之所以没有用tasklist关闭进程,是因为我曾经看到过一些资料说:
ntsd能关闭一些tasklist无法关闭的进程.
这种说法对吗?
The 2nd one, because it kept prompting for the PID of notepad.exe that I needed to enter. There was no way, so I actively closed the CMD window.
Then re-enter CMD and execute
tasklist | findstr /i "notepad.exe"
And see that notepad.exe is still there, not closed. The notepad file I ran before the test is also well in the taskbar, not closed at all, so I said this segment of code of ntsd doesn't work.
The reason I didn't use tasklist to close the process is because I once saw some materials saying:
ntsd can close some processes that tasklist can't close.
Is this statement correct?
附件
1: 4.JPG (2008-10-28 08:04, 38.48 KiB)
|
|
2008-10-28 08:04 |
|
|
newsuper
新手上路
 坚持学习
积分 18
发帖 15
注册 2008-10-18
状态 离线
|
『第 13 楼』:
我用ntsd结束了记事本程序
使用 LLM 解释/回答一下
我用ntsd结束了记事本程序啊
方法跟我10楼的一样,只是把最后一句taskkill换成了ntsd了。不知道大家是什么结果?
@echo off
start /min notepad.exe
for /f "tokens=1,2" %%i in ('tasklist.exe') do if "%%i"=="notepad.exe" echo %%j
set /p cp=请输入你要结束的进程的PID
ntsd -c q -p %cp%
I used ntsd to end the Notepad program.
The method is the same as my 10th floor, just changed the last line of taskkill to ntsd. I don't know what the results are for everyone?
@echo off
start /min notepad.exe
for /f "tokens=1,2" %%i in ('tasklist.exe') do if "%%i"=="notepad.exe" echo %%j
set /p cp=Please enter the PID of the process you want to end
ntsd -c q -p %cp%
|
|
2008-10-28 19:21 |
|
|
HAT
版主
       
积分 9023
发帖 5017
注册 2007-5-31
状态 离线
|
『第 14 楼』:
Re 12楼
使用 LLM 解释/回答一下
你这个截图用的是6楼的代码么?
Did you use the code from floor 6 in this screenshot?
|

 |
|
2008-10-28 20:51 |
|
|
tempuser
高级用户
   
积分 547
发帖 261
注册 2006-4-15
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
回斑竹HAT:绝对用的是6楼的代码,结果正如我的贴图,不能关闭进程.
问newsuper:你能把你测试的过程贴图出来吗?我根本就不能关闭notepad.exe进程?
Reply to moderator HAT: Definitely used the code from floor 6, and the result is as my screenshot shows, can't close the process.
Ask newsuper: Can you post the screenshot of your testing process? I simply can't close the notepad.exe process?
|
|
2008-10-29 10:49 |
|