How can I kill a process by its name using batch?

0

Hello my question is simple as I could do using batch to kill a process only by its name not by its pid or process id, only its name. I would have to use taskkill / m and the process. but in my case I would not be worth the pid but the name.

How can I do to kill the process only by using its name?

If it were not possible then some other possible alternative in some other language.

    
asked by Jesus Garcia 28.12.2017 в 18:46
source

2 answers

0

You can use the taskkill /IM nombre.exe /F (Si es necessario forzar) command.

IM is Image Name, you can see the IM using the command tasklist

For example, you open a notepad and type

taskkill /IM notepad.exe

Your notebook will be closed and this message will appear:

CORRECTO: señal de terminación enviada al proceso "notepad.exe" con PID 12284.

I hope I have solved the problem.

    
answered by 28.12.2017 / 19:05
source
0

Use this

taskkill /im "nombre.exe" /f >nul 2>nul

/ IM is used for the name.

/ F to force the arrest.

& nt; nul so that the command has no output.

2> nul so that the command has no output with errorlevel 2.

    
answered by 26.01.2018 в 19:56