Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Shell 

Simple Taskmanger with Taskkill-function

Hey guys,

I just created a simple Taskmanager. It lists all active tasks and you are able to kill a task by writing it's name.
I hope that the source will be helpful for people who want to learn more about batch-programming.

Here's the code. Simply copy it into a textfile and save it as .bat
Code
@echo off
set ver=1.0
title Taskmanager %ver%

cls
del tasklist.txt
del temp.txt
for /f %%x in ('tasklist /fi "status eq running"') do echo %%x >> tasklist.txt
sort tasklist.txt > temp.txt
cls
echo ------ Taskmanager %ver% ------
echo by 1337LnD for Hackforums.net
echo.
echo Runnings Tasks
type temp.txt
echo ------------------------------------------------------
echo           The running tasks are listed above
echo.
echo           If you want to kill a task, please write it's name
echo           If you just want to quit, write "exit"
:Action
set /p taskkill="Taskname: "
:Kill
if "%taskkill%"=="exit" goto Exit
tasklist /fi "imagename eq %taskkill%" |find ":" > nul
if errorlevel = 1 (
taskkill /im %taskkill%
echo "%taskkill%" was sucessfully killed!
echo.
echo           If you want to kill another task, please write it's name
echo           Otherwise just write just "exit"
set /p taskkill="Taskname: "
goto Kill
) else (
if errorlevel = 0 echo           Error! The Task "%taskkill%" was not found. Try again.
goto Action
)
:Exit
del tasklist.txt
del temp.txt
exit

Enjoy!  🤝
I'm just getting continuous errors when I attempt to run it? I read through the script but couldn't find where the problem was though.

[Image: 77732e31aaf14338324011809d6171f1.png]
[Image: kwhosZp.png]

I have modified your batch script and now it works.

Code
@echo off
set ver=1.0
title Taskmanager %ver%

Cls
for /f "Tokens=*" %%x in ('tasklist /fi "status eq running"') do @Echo %%x    

echo.
echo.
echo ------ Taskmanager %ver% ------
echo by 1337LnD for Hackforums.net
echo.
echo Runnings Tasks

echo ------------------------------------------------------
echo           The running tasks are listed above
echo.
echo           If you want to kill a task, please write it's name
echo           If you just want to quit, write "exit"
:Action
set /p taskkill="Taskname: "
:Kill
if "%taskkill%"=="exit" goto Exit
tasklist /fi "imagename eq %taskkill%" |find ":" > nul
if errorlevel = 1 (
taskkill /im %taskkill%
echo "%taskkill%" was sucessfully killed!
echo.
echo           If you want to kill another task, please write it's name
echo           Otherwise just write just "exit"
set /p taskkill="Taskname: "
goto Kill
) else (
if errorlevel = 0 echo           Error! The Task "%taskkill%" was not found. Try again.
goto Action
)
:Exit

exit
(Mar 31, 2018 07:47 AM)Phlox Wrote:  [Image: kwhosZp.png]

I have modified your batch script and now it works.

Code
@echo off
set ver=1.0
title Taskmanager %ver%

Cls
for /f "Tokens=*" %%x in ('tasklist /fi "status eq running"') do @Echo %%x    

echo.
echo.
echo ------ Taskmanager %ver% ------
echo by 1337LnD for Hackforums.net
echo.
echo Runnings Tasks

echo ------------------------------------------------------
echo           The running tasks are listed above
echo.
echo           If you want to kill a task, please write it's name
echo           If you just want to quit, write "exit"
:Action
set /p taskkill="Taskname: "
:Kill
if "%taskkill%"=="exit" goto Exit
tasklist /fi "imagename eq %taskkill%" |find ":" > nul
if errorlevel = 1 (
taskkill /im %taskkill%
echo "%taskkill%" was sucessfully killed!
echo.
echo           If you want to kill another task, please write it's name
echo           Otherwise just write just "exit"
set /p taskkill="Taskname: "
goto Kill
) else (
if errorlevel = 0 echo           Error! The Task "%taskkill%" was not found. Try again.
goto Action
)
:Exit

exit

which version of windows are you using? I'm just getting a blank terminal
https://gyazo.com/e5a1c12420b16dc7f682db7f74447ead
Windows 10 Pro 64-bit.

[Image: 2sN5j3W.png]
I'm using Windows 7 64-bit and it is working fine. I haven't tested it on other machines.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by FhackMar 2, 2022 03:52 AM 4 307 Mar 2, 2022 03:52 AM
Last Post: Fhack
[C] by ReporterJan 30, 2017 02:41 PM 7 444 Jan 30, 2017 02:41 PM
Last Post: 0xDEAD10CC
[C] by GoodiesMay 4, 2016 02:26 PM 8 626 May 4, 2016 02:26 PM
Last Post: Goodies