0

How to end/stop a task/programm in batch-files quickly ?

If it's possible to stop all programms with one command please say it to me.

I triedtaskkill firefox But it doesnt work

Thank you for answers ; )

user8470476
  • 1
  • 1
  • 3

2 Answers2

1

For Example,

TASKKILL /IM notepad.exe

You can replace the taskname notepad.exe with your process.

You can check running process from Task manager » Process

you can find the Firefox process name there, if it is running.

Philip
  • 409
  • 5
  • 13
0

Here is a batch file to kill a process or many processes separated by a space :

@echo off
Title Process Killer by Hackoo 2017
Mode 80,5 & color 0B
Set "TmpFile=%Temp%\TmpFile.txt"
Set "Result=%Temp%\KillResult.txt"
If Exist "%TmpFile%" Del "%TmpFile%"
If Exist "%Resultat%" Del "%Resultat%"
echo(
echo     Enter the process name or processes names separated by a space
echo(
set /p "process=What process(es) do you want to kill ? > "
cls & color 0C
Title Killing "%process%" ...
echo(
echo %date% *** %time% >"%TmpFile%"
For %%a in (%process%) Do Call :KillMyProcess %%a
Cmd /U /C Type "%TmpFile%" >"%Result%"
Timeout /T 2 /nobreak>nul
Start "" "%Result%"
::*********************************************************************************************
:KillMyProcess
Set "Process=%~1"
echo                 Killing "%process%" ...
echo "%Process%" | find /I ".exe" >nul 2>&1  && (
    Taskkill /IM "%Process%" /F >>"%TmpFile%" 2>&1
) || (
    Taskkill /IM "%~n1.exe" /F >>"%TmpFile%" 2>&1
)
echo *****************************************************************************>>"%TmpFile%"
exit /b
::**********************************************************************************************
Hackoo
  • 18,337
  • 3
  • 40
  • 70