TechSpot

Command for endtask in cmd win xp

By linux44
Dec 24, 2007
  1. hi
    i just want to know is there any command that can help to endtask a program which is currently working on windows
    i know i can endtask them in graphic mode but i just want to know if there is any command that can help for endtask one program in cmd windows xp
    i thought about that because i think my windows has virus and when i try to endtask some of the proccess which is for application not system file it give me error and i think the only way would be to do it in cmd


    any ideas?
    thanks
     
  2. devil_himself

    devil_himself TS Rookie Posts: 23

    Taskkill

    TASKKILL [/S system [/U username [/P [password]]]]
    { [/FI filter] [/PID processid | /IM imagename] } [/F] [/T]

    Description:
    This command line tool can be used to end one or more processes.
    Processes can be killed by the process id or image name.

    Parameter List:
    /S system Specifies the remote system to connect to.

    /U [domain\]user Specifies the user context under which
    the command should execute.

    /P [password] Specifies the password for the given
    user context. Prompts for input if omitted.

    /F Specifies to forcefully terminate
    process(es).

    /FI filter Displays a set of tasks that match a
    given criteria specified by the filter.

    /PID process id Specifies the PID of the process that
    has to be terminated.

    /IM image name Specifies the image name of the process
    that has to be terminated. Wildcard '*'
    can be used to specify all image names.

    /T Tree kill: terminates the specified process
    and any child processes which were started by it.

    /? Displays this help/usage.

    Filters:
    Filter Name Valid Operators Valid Value(s)
    ----------- --------------- --------------
    STATUS eq, ne RUNNING | NOT RESPONDING
    IMAGENAME eq, ne Image name
    PID eq, ne, gt, lt, ge, le PID value
    SESSION eq, ne, gt, lt, ge, le Session number.
    CPUTIME eq, ne, gt, lt, ge, le CPU time in the format
    of hh:mm:ss.
    hh - hours,
    mm - minutes, ss - seconds
    MEMUSAGE eq, ne, gt, lt, ge, le Memory usage in KB
    USERNAME eq, ne User name in [domain\]user
    format
    MODULES eq, ne DLL name
    SERVICES eq, ne Service name
    WINDOWTITLE eq, ne Window title

    NOTE: Wildcard '*' for the /IM switch is accepted only with filters.

    NOTE: Termination of remote processes will always be done forcefully
    irrespective of whether /F option is specified or not.

    Examples:
    TASKKILL /S system /F /IM notepad.exe /T
    TASKKILL /PID 1230 /PID 1241 /PID 1253 /T
    TASKKILL /F /IM notepad.exe /IM mspaint.exe
    TASKKILL /F /FI "PID ge 1000" /FI "WINDOWTITLE ne untitle*"
    TASKKILL /F /FI "USERNAME eq NT AUTHORITY\SYSTEM" /IM notepad.exe
    TASKKILL /S system /U domain\username /FI "USERNAME ne NT*" /IM *
    TASKKILL /S system /U username /P password /FI "IMAGENAME eq note*"
     
  3. linux44

    linux44 TS Rookie Topic Starter Posts: 21

    command line

    hi
    thanks for response
    but the problem is i never get to understand that command line help for exmple if i go to cmd and type taskkill/? it show me all the paramete but it is difficault to understant the stracture
    for example
    TASKKILL [/S system [/U username [/P [password]]]]
    { [/FI filter] [/PID processid | /IM imagename] } [/F] [/T]

    i dont know how should i do it i mean like do i need to type the } or ] because most of the time i use them and cmd give me a error

    could you please explain how should i understand the structure
    thanks again
     
  4. devil_himself

    devil_himself TS Rookie Posts: 23

  5. devil_himself

    devil_himself TS Rookie Posts: 23

    Vbscript To Terminate a Process

    Save As "TerminateProcess.vbs"

    Code:
    Dim objWMIService, objProcess, colProcess
    Dim strComputer, strProcessKill
    strComputer = "."
    strProcessKill = "'Notepad.exe'"
    
    Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set colProcess = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = " & strProcessKill )
    For Each objProcess in colProcess
       objProcess.Terminate()
    Next 
    
     
  6. wildman6801

    wildman6801 TS Rookie Posts: 63

    First go to the command line then type "tasklist | more" then push enter. Push enter to move thru until you get to another prompt. Make a note of which PID the second column over from the left.

    Then type "taskkill /PID ####" replace the #### with the PID you made a note of in step one. Then push enter. This will kill the process.

    I would suggest to do a test with Notepad first. Open up notepad the go to the command line and try the above steps. Make sure you have the right PID number or you will kill another program!
     
Topic Status:
Not open for further replies.

Similar Topics

Add New Comment

You need to be a member to leave a comment. Join thousands of tech enthusiasts and participate.
TechSpot Account You may also...