问:怎么才能关掉一个用任务管理器关不了的进程?我前段时间发现我的机子里多了一个进程,只要开机就在,我用任务管理器却怎么关也关不了 

  答1:杀进程很容易,随便找个工具都行。比如IceSword。关键是找到这个进程的启动方式,不然下次重启它又出来了。顺便教大家一招狠的。其实用Windows自带的工具就能杀大部分进程:

  1. c:\>ntsd -c q -p PID 

  只有System、SMSS.EXE和CSRSS.EXE不能杀。前两个是纯内核态的,最后那个是Win32子系统,ntsd本身需要它。ntsd从2000开始就是系统自带的用户态调试工具。被调试器附着(attach)的进程会随调试器一起退出,所以可以用来在命令行下终止进程。使用ntsd自动就获得了debug权限,从而能杀掉大部分的进程。ntsd会新开一个调试窗口,本来在纯命令行下无法控制,但如果只是简单的命令,比如退出(q),用-c参数从命令行传递就行了。NtsdNtsd 按照惯例也向软件开发人员提供。只有系统开发人员使用此命令。有关详细信息,请参阅 NTSD 中所附的帮助文件。用法:开个cmd.exe窗口,输入:

  1. ntsd -c q -p PID  


  把最后那个PID,改成你要终止的进程的ID。如果你不知道进程的ID,任务管理器->进程选项卡->查看->选择列->勾上"PID(进程标识符)",然后就能看见了。 

  答2:xp下还有两个好东东tasklist和tskill。tasklist能列出所有的进程,和相应的信息。tskill能查杀进程,语法很简单:tskill 程序名!! 

  1. usage: ntsd [options]  
  2.  
  3. Options:  
  4.  
  5.   <command-line> command to run under the debugger  
  6.   -? displays command line help text  
  7.   -- equivalent to -G -g -o -p -1 -d -pd  
  8.   -2 creates a separate console window for debuggee  
  9.   -a<DllName> adds a default extension DLL  
  10.   -bonc request break in after session started  
  11.   -c "<command>" executes the given debugger command at the first debugger  
  12.                  prompt  
  13.   -cf <file> specifies a script file to be processed at the first debugger  
  14.              prompt  
  15.   -clines <#> number of lines of output history retrieved by a remote client  
  16.   -d sends all debugger output to kernel debugger via DbgPrint  
  17.      input is requested from the kernel debugger via DbgPrompt  
  18.      -d cannot be used with debugger remoting  
  19.      -d can only be used when the kernel debugger is enabled  
  20.   -ddefer sends all debugger output to kernel debugger via DbgPrint  
  21.           input is requested from the kernel debugger via DbgPrompt unless  
  22.           there are remote clients that can provide input  
  23.           -ddefer can only be used when the kernel debugger is enabled  
  24.           -ddefer should be used with -server  
  25.   -ee <name> set default expression evaluator  
  26.              <name> can be MASM or C++  
  27.   -failinc causes incomplete symbol and module loads to fail  
  28.   -g ignores initial breakpoint in debuggee  
  29.   -G ignores final breakpoint at process termination  
  30.   -hd specifies that the debug heap should not be used for created processes.  
  31.       This only works on Windows XP and later  
  32.   -i <ImagePath> specifies the location of the executables that generated the  
  33.                  fault (see _NT_EXECUTABLE_IMAGE_PATH)  
  34.   -isd sets the CREATE_IGNORE_SYSTEM_DEFAULT flag in STARTUPINFO.dwFlags  
  35.        during CreateProcess  
  36.   -lines requests that line number information be used if present  
  37.   -loga <logfile> appends to a log file  
  38.   -logo <logfile> opens a new log file  
  39.   -myob ignores version mismatches in DBGHELP.DLL  
  40.   -n enables verbose output from symbol handler  
  41.   -noio disables all I/O for dedicated remoting servers  
  42.   -noshell disables the .shell (!!) command  
  43.   -o debugs all processes launched by debuggee  
  44.   -p <pid> specifies the decimal process ID to attach to  
  45.   -pb specifies that the debugger should not break in at attach  
  46.   -pd specifies that the debugger should automatically detach  
  47.   -pe specifies that any attach should be to an existing debug port  
  48.   -pn <name> specifies the name of the process to attach to  
  49.   -pr specifies that the debugger should resume on attach  
  50.   -premote <transport>:server=<name>,<params>  
  51.     specifies the process server to connect to  
  52.     transport arguments are given as with remoting  
  53.   -pt <#> specifies the interrupt timeout  
  54.   -pv specifies that any attach should be noninvasive  
  55.   -pvr specifies that any attach should be noninvasive and nonsuspending  
  56.   -QR \\<machine> queries for remote servers  
  57.   -r <BreakErrorLevel> specifies the (0-3) error level to break on (see  
  58.                        SetErrorLevel)  
  59.   -remote <transport>:server=<name>,<params>  
  60.     lets you connect to a debugger session started with -server  
  61.     must be the first argument if present  
  62.       transport: tcp | npipe | ssl | spipe | 1394 | com  
  63.       name: machine name on which the debug server was created  
  64.       params: parameters the debugger server was created with  
  65.         for tcp use:  port=<socket port #>  
  66.         for npipe use:  pipe=<name of pipe>  
  67.         for 1394 use:  channel=<channel #>  
  68.         for com use:  port=<COM port>,baud=<baud rate>,  
  69.                       channel=<channel #>  
  70.         for ssl and spipe see the documentation  
  71.       example: ... -remote npipe:server=yourmachine,pipe=foobar  
  72.   -robp allows breakpoints to be set in read-only memory  
  73.   -rtl uses RtlCreateUserProcess instead of Win32 CreateProcess  
  74.   -s disables lazy symbol loading  
  75.   -sdce pops up dialogs for critical errors  
  76.   -secure disallows operations dangerous for the host  
  77.   -server <transport>:<params>  
  78.     creates a debugger session other people can connect to  
  79.     must be the first argument if present  
  80.       transport: tcp | npipe | ssl | spipe | 1394 | com  
  81.       params: connection parameterization  
  82.         for tcp use:  port=<socket port #>  
  83.         for npipe use:  pipe=<name of pipe>  
  84.         for 1394 use:  channel=<channel #>  
  85.         for com use:  port=<COM port>,baud=<baud rate>,  
  86.                       channel=<channel #>  
  87.         for ssl and spipe see the documentation  
  88.       example: ... -server npipe:pipe=foobar  
  89.   -ses enables strict symbol loading  
  90.   -sfce fails critical errors encountered during file searching  
  91.   -sflags <flags> sets symbol flags from a numeric argument  
  92.   -sicv ignores the CV record when symbol loading  
  93.   -sins ignores the symbol path environment variables  
  94.   -snc converts :: to __ in symbol names  
  95.   -snul disables automatic symbol loading for unqualified names  
  96.   -srcpath <SourcePath> specifies the source search path  
  97.   -sup enables full public symbol searches  
  98.   -t <PrintErrorLevel> specifies the (0-3) error level to display (see  
  99.                        SetErrorLevel)  
  100.   -v enables verbose output from debugger  
  101.   -w specifies to debug 16 bit applications in a separate VDM  
  102.   -wake <pid> wakes up a sleeping debugger and exits  
  103.   -x sets second-chance break on AV exceptions  
  104.   -x{e|d|n|i} <event> sets the break status for the specified event  
  105.   -y <SymbolsPath> specifies the symbol search path (see _NT_SYMBOL_PATH)  
  106.   -z <CrashDmpFile> specifies the name of a crash dump file to debug  
  107.   -zp <CrashPageFile> specifies the name of a page.dmp file to use with a  
  108.                       crash dump  
  109.  
  110. Environment Variables:  
  111.  
  112.     _NT_SYMBOL_PATH=[Drive:][Path]  
  113.         Specify symbol image path.  
  114.  
  115.     _NT_ALT_SYMBOL_PATH=[Drive:][Path]  
  116.         Specify an alternate symbol image path.  
  117.  
  118.     _NT_DEBUGGER_EXTENSION_PATH=[Drive:][Path]  
  119.         Specify a path which should be searched first for extensions dlls  
  120.  
  121.     _NT_EXECUTABLE_IMAGE_PATH=[Drive:][Path]  
  122.         Specify executable image path.  
  123.  
  124.     _NT_SOURCE_PATH=[Drive:][Path]  
  125.         Specify source file path.  
  126.  
  127.     _NT_DEBUG_LOG_FILE_OPEN=filename  
  128.         If specified, all output will be written to this file from offset 0.  
  129.  
  130.     _NT_DEBUG_LOG_FILE_APPEND=filename  
  131.         If specified, all output will be APPENDed to this file.  
  132.  
  133.     _NT_DEBUG_HISTORY_SIZE=size  
  134.         Specifies the size of a server's output history in kilobytes  
  135.  
  136. Control Keys:  
  137.  
  138.      <Ctrl-B><Enter> Quit debugger  
  139.      <Ctrl-C>        Break into Target  
  140.      <Ctrl-F><Enter> Force a break into debuggee (same as Ctrl-C)  
  141.      <Ctrl-P><Enter> Debug Current debugger  
  142.      <Ctrl-V><Enter> Toggle Verbose mode  
  143.      <Ctrl-W><Enter> Print version information  
  144. ntsd: exiting - press enter --- 

本日志由 flyinweb 于 2009-06-18 19:22:53 发表到 Windows 中,目前已经被浏览 3906 次,评论 0 次;

作者添加了以下标签: 进程管理工具ntsd