|
| ||||||||||
| Tags: batch, batch file, processes, windows server |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| how can i create a Batch file to kill some processes by name
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
| |||
| |||
| 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
| |||
| |||
| 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
| |||
| |||
| 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
| |||
| |||
| 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
| ||||
| ||||
| 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........ |
|
#7
| |||
| |||
| 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
| |||
| |||
| 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 |
![]() |
|
| 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 |
| I want to create a TCP/IP Batch file | aladdin | Software Development | 1 | 14-02-2012 10:59 PM |
| Help me create this batch file. | bomblast | Windows Software | 1 | 31-10-2011 10:47 AM |
| End Multiple Processes With The Help Of Batch File | Sheenas | Operating Systems | 6 | 21-04-2011 12:53 AM |
| How to create batch for RAR file extension | Jayden | Windows Software | 1 | 13-04-2009 11:58 PM |
| How to create a Batch file | Katty | Software Development | 1 | 10-01-2009 12:26 PM |