|
| |||||||||
| Tags: batch, create, kill, option, processes, taskkill |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| 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... thanks |
|
#2
| |||
| |||
| Re: how can i create a Batch file to kill some processes by name "Hansel Ortiz -[BrEcHaWarr]" <hansel.ortiz@gmail.com> wrote in message news:2018fa9c-896b-459e-9953-f9f09bc00850@f63g2000hsf.googlegroups.com... > 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... > > > thanks Type taskkill /? at the Command Prompt to get the full help for this command (and, for that, for any other console command!). |
|
#3
| |||
| |||
| Re: how can i create a Batch file to kill some processes by name
On Sep 23, 1:57*pm, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote: > "Hansel Ortiz -[BrEcHaWarr]" <hansel.or...@gmail.com> wrote in messagenews:2018fa9c-896b-459e-9953-f9f09bc00850@f63g2000hsf.googlegroups.com... > > > 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... > > > thanks > > Type taskkill /? at the Command Prompt to get the full help for this command > (and, for that, for any other console command!). 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
| |||
| |||
| Re: how can i create a Batch file to kill some processes by name "Hansel Ortiz -[BrEcHaWarr]" <hansel.ortiz@gmail.com> wrote in message news:1b5ca0fe-2938-4b58-8f73-4354f0b74ac2@z72g2000hsb.googlegroups.com... On Sep 23, 1:57 pm, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote: > "Hansel Ortiz -[BrEcHaWarr]" <hansel.or...@gmail.com> wrote in > messagenews:2018fa9c-896b-459e-9953-f9f09bc00850@f63g2000hsf.googlegroups.com... > > > 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... > > > thanks > > Type taskkill /? at the Command Prompt to get the full help for this > command > (and, for that, for any other console command!). 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
| |||
| |||
| 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 ------------------ With best regards Andrew Mishechkin "Hansel Ortiz -[BrEcHaWarr]" <hansel.ortiz@gmail.com> сообщил/сообщила в новостях следующее: news:2018fa9c-896b-459e-9953-f9f09bc00850@f63g2000hsf.googlegroups.com... > 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... > > > thanks |
|
#6
| ||||
| ||||
| 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,
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........ |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "how can i create a Batch file to kill some processes by name" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help me create this batch file. | bomblast | Windows Software | 1 | 31-10-2011 11:47 AM |
| End Multiple Processes With The Help Of Batch File | Sheenas | Operating Systems | 6 | 21-04-2011 01:53 AM |
| How to create batch for RAR file extension | Jayden | Windows Software | 1 | 14-04-2009 12:58 AM |
| .Bat file to kill processes upon confirmation | stevetilsed | Windows XP Support | 8 | 26-02-2009 02:52 PM |
| How to create a Batch file | Katty | Software Development | 1 | 10-01-2009 01:26 PM |