Reputation: 1
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 ; )
Upvotes: 0
Views: 4270
Reputation: 18857
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
::**********************************************************************************************
Upvotes: 0
Reputation: 499
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.
Upvotes: 1