如何通过Windows cmd中的进程ID来终止Java应用程序?
问题描述:
当我运行命令:taskkill /f /pid 16140
如何通过Windows cmd中的进程ID来终止Java应用程序?
我得到这个:ERROR: The process "16140" not found.
答
taskkill /im myprocess.exe /f
的 “/ F” 是 “力量”。如果你知道的PID,那么你可以指定,如:
taskkill /pid 1234 /f
很多其他的选择都是可能的,只要键入taskkill /?为他们所有。 “/ t”选项杀死进程和任何子进程;这可能对您有用
答
您可以通过进程ID(PID)或映像名称(EXE文件名)来终止进程。
打开一个行政级别的命令提示符,然后运行任务列表来查看所有正在运行的进程:
C:\>tasklist
Image Name PID Session Name Mem Usage
========================= ======== ================ ============
firefox.exe 26356 Console 139,352 K
regedit.exe 24244 Console 9,768 K
cmd.exe 18664 Console 2,380 K
conhost.exe 2528 Console 7,852 K
notepad.exe 17364 Console 7,892 K
notepad.exe 24696 Console 22,028 K
notepad.exe 25304 Console 5,852 K
explorer.exe 2864 Console 72,232 K
在上面的例子中,你可以看到图像的名称和PID为每个进程。如果你想杀死Firefox进程运行:
C:\>Taskkill /IM firefox.exe /F
或
C:\>Taskkill /PID 26356 /F
/f标记是强行终止进程。不使用/ F标志在某些情况下不会导致任何事情发生。一个例子是每当我想杀死explorer.exe进程时,我必须使用/ F标志,否则进程不会终止。
如何知道pid是16140? –
A)这不是一个Java问题B)如何获得该PID号码?你看,可能这个数字是错的? – GhostCat
你应该问[这里](https://superuser.com/questions/ask)。 –