Results 1 to 8 of 8

Thread: how can i create a Batch file to kill some processes by name

  1. #1
    Hansel Ortiz -[BrEcHaWarr] Guest

    how can i create a Batch file to kill some processes by name

    hi guys... i`ll be searching in the web trying to find a script to
    kill one or various process, but i just can find
    how to kill process by pid.

    how can i to this.... just searching the name process like Starting
    with X.... or task%..
    something like that.. if someone could help..

    i couldn`t find the sintax of the taskkill to refer this command to a
    name.. just pid and others...

  2. #2
    Pegasus \(MVP\) Guest

    Re: how can i create a Batch file to kill some processes by name

    Type taskkill /? at the Command Prompt to get the full help for this command
    (and, for that, for any other console command!).

  3. #3
    Hansel Ortiz -[BrEcHaWarr] Guest

    Re: how can i create a Batch file to kill some processes by name

    well.. i just need the reference to search a process for name, i used
    taskkill /? and i dont know wich one to use :S


    i Try this batch file version. but trying to change the syntax of
    the "notepad.exe"
    for examble --->>> "Note%" all processes that start with 'note'

    @echo off
    set prev=
    FOR /F "tokens=2" %%i IN ('tasklist ^| Find /i "notepad.EXE"') DO CALL
    :windowlist %%i
    goto :EOF

    :windowlist
    if not "%prev%"=="" echo TASKKILL /PID %prev% /F
    set prev=%1

  4. #4
    Pegasus \(MVP\) Guest

    Re: how can i create a Batch file to kill some processes by name

    well.. i just need the reference to search a process for name, i used
    taskkill /? and i dont know wich one to use :S


    i Try this batch file version. but trying to change the syntax of
    the "notepad.exe"
    for examble --->>> "Note%" all processes that start with 'note'

    @echo off
    set prev=
    FOR /F "tokens=2" %%i IN ('tasklist ^| Find /i "notepad.EXE"') DO CALL
    :windowlist %%i
    goto :EOF

    :windowlist
    if not "%prev%"=="" echo TASKKILL /PID %prev% /F
    set prev=%1

    ================

    The batch file you quote does something quite different from what you want:
    It kills every "notepad" process except for the last one in the list. If you
    want to kill all processes whose names contain the word "note" then you can
    do it much more simply:

    @echo off
    setlocal EnableDelayedExpansion
    set PIDs=
    for /F "tokens=2" %%a in ('tasklist ^| find "note"') do set PIDs=!PIDs! /pid
    %%a
    echo TaskKill %PIDs% /F /T

    Remove the word "echo" in the last line to activate the batch file.

  5. #5
    Andrew Mishechkin Guest

    Re: how can i create a Batch file to kill some processes by name

    Here my cmd-file: pskill.cmd
    -------------
    @ECHO OFF
    REM Using this bat-file: pskill ProcessName [RemoteComputerName] [UserName]
    [UserPassword]
    IF "%1"=="" (GOTO Error)
    IF "%2"=="" (SET NodeName=.) ELSE (SET NodeName=%2)
    IF NOT "%3"=="" (GOTO AnotherUser)
    wmic /NODE:%NodeName% PROCESS WHERE (name="%1") CALL TERMINATE
    GOTO End

    :AnotherUser
    SET UserName=%3
    IF NOT "%4"=="" (SET Password=%4) ELSE (SET Password="")
    wmic /NODE:%NodeName% /User:%UserName% /Password:%Password% PROCESS WHERE
    (name="%1") CALL TERMINATE
    GOTO End

    :Error
    ECHO Using this bat-file: pskill ProcessName [RemoteComputerName] [UserName]
    [UserPassword]

    :End
    ------------------

  6. #6
    Join Date
    Apr 2011
    Posts
    2

    how can i create a Batch file to kill some processes by name

    Hello guys,

    I have found a simple way to kill a task using the batch file...... it is as follows,

    the command is "taskkill"

    you can do this by,

    1. Knowing the PID of the process
    2. Knowing the image name of the process


    For example,
    If you want to end the notepad, then command is "taskkill /im notepad.exe
    where "im" is the image name of the process. i.e. notepad

    you can also end any process by using its PID also. the eg for this is,
    "taskkill /pid 5264" where pid is process identifier and it may be 5264....

    if you want to know the process name and process id, then u can see it in task manager. if pid is not displayed then go to view>select columns>process identifier in task manager..

    you can also force to end the process so as not to display any message box . you can do it by, adding the /f command to it......
    note that /f should be given as, "taskkill /f /im notepad.exe

    you can also enter any number of within a single command....... to do so, enter as, "taskkill /im program1 /im program2 /im program3 and so on" or use the pid of the process in the same way.......

    if you have any doubts you can type "taskkill /?" in command prompt to view the help.....

    try it out.........
    discover things.........
    share your thoughts........

  7. #7
    Join Date
    Sep 2011
    Posts
    1

    Kill misc processes

    I want to do just the opposite. I want to have a file with processses that I DON't want to disable because they are required, or the computer crashes. I want to kill everything no in a list.

  8. #8
    Join Date
    Jan 2006
    Posts
    605

    Re: how can i create a Batch file to kill some processes by name

    You can try the below code or similar syntax to enable any kind of apps that you want.

    Code:
    cd "C:\Program Files\Adobe"
    start Adobe
    cd "C:\Program Files\Nokia PC Suite"
    start Nokia PC Suite
    cd "C:\Program Files\Microsoft Office"
    start Microsoft Office
    cd "C:\Program Files\Stardock\Realtek"
    start Realtek

Similar Threads

  1. I want to create a TCP/IP Batch file
    By aladdin in forum Software Development
    Replies: 1
    Last Post: 14-02-2012, 11:59 PM
  2. Help me create this batch file.
    By bomblast in forum Windows Software
    Replies: 1
    Last Post: 31-10-2011, 10:47 AM
  3. End Multiple Processes With The Help Of Batch File
    By Sheenas in forum Operating Systems
    Replies: 6
    Last Post: 21-04-2011, 12:53 AM
  4. How to create batch for RAR file extension
    By Jayden in forum Windows Software
    Replies: 1
    Last Post: 13-04-2009, 11:58 PM
  5. How to create a Batch file
    By Katty in forum Software Development
    Replies: 1
    Last Post: 10-01-2009, 01:26 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,618,229.31287 seconds with 17 queries