TaskMon - interactive task monitor/killer

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
misol101
Posts: 475
Joined: 02 May 2016 18:20

TaskMon - interactive task monitor/killer

#1 Post by misol101 » 25 May 2017 18:07

!!!! New, faster version 1.2 is here: http://www.mediafire.com/file/9xxzfbwn4 ... mon1_2.zip

Image
Here is an attempt at an interactive task monitor. Keys while running are (also available from help while running by pressing F1 or '?'):

Code: Select all

 Up/Down/Left/Right/Home/End/PageUp/PageDown: navigate
 Alt-key: jump to next item starting with key
 u: refresh list/screen
 s: specify sorting order
 +: extended process info on/off
 q: quit

 x: kill process
 X: force kill process
 a: kill all processes with this name
 A: force kill all processes with this name
 p: launch command prompt
 m: show used modules for all processes
 l: show used services for all processes

 Space/^Space: select item / deselect all items
 ^X: Force kill all selected items

 Mouse click: navigate to item
 Mouse wheel: switch page
 Mouse right double click: force kill process

So, essentially, navigate with cursor keys or mouse, update process list with 'u', and kill the current process with 'x'. Navigation is horizontal, so use cursor left/right to go between pages.


Code: Select all

Arguments: taskmon [width] [height] [+|-] [[-]sort column 0-9]

+ or - means use extended info or not (tasklist -v switch)
For sorting, 0 means unsorted, and 1 is name, 2 is PID etc. I don't know if tasklist uses the same format in different Windows versions/languages, so the only sort options "guaranteed" to work are 0 and 1.

!!!! New, much faster version 1.2 is here: http://www.mediafire.com/file/9xxzfbwn4 ... mon1_2.zip (not attached due to being >100k). Non-extended process info is now default when running to speed things up. Press '+' while running to get extended process info. (Or, to turn it on by default, edit tm.bat to say "set T_X=+").
!!!
Attachments
taskmon1_1.zip
New version which is easily extendable and has extra functionality through NirCmd/Powershell
(84.9 KiB) Downloaded 434 times
taskmon.zip
(83.58 KiB) Downloaded 575 times
Last edited by misol101 on 27 Aug 2017 03:36, edited 13 times in total.

misol101
Posts: 475
Joined: 02 May 2016 18:20

Re: TaskMon - interactive task monitor/killer

#2 Post by misol101 » 25 May 2017 18:27

Two more things:

What is stupid.exe?

It's this program compiled :lol: :

Code: Select all

#include <windows.h>

void main(void) {
   while(1)
      Sleep(1000);
}

In other words, it does nothing except sleep inside a loop, forever.

It can be useful to test out the taskmon script. For example, if you write:

Code: Select all

for /l %a in (1,1,10) do start stupid.exe
then you get 10 running processes that you can kill from within taskmon without worries.


How to change stuff/colors in the code and why does this look/behave like listb.bat?

If you look in the code and feel like there seems to be extra fluff here and there, that's because this script is a quickly edited version of my listb.bat file explorer script.

Some things to possibly change for customization:

Code: Select all

Line 6: default width of screen (210)
Line 7: default height of screen (50)
Line 27: set EXTINFO to 0 if you don't want extended process info by default (this also makes the program faster)
Line 29: set SORT to any column 1 to 9, or 0 for unsorted
Line 36 and 37: the colors used for the top and bottom bars
Line 39: the background color used for the current item
Line 42: text color for processes. 'u' means use the current color of the cmd window, but can be forced to a color too
Line 43: color used for header
Line 49: color used for dividing line between tasks and header
etc
Last edited by misol101 on 25 May 2017 19:14, edited 3 times in total.

misol101
Posts: 475
Joined: 02 May 2016 18:20

Re: TaskMon - interactive task monitor/killer

#3 Post by misol101 » 25 May 2017 18:30

Thoughts and suggestions? Is it working?

I am a bit worried that especially navigation might be slow on some computers (Win 10..?), since it does call external commands (gotoxy) quite a lot, and the startup cost for each such call seems to be high on Win10. In such case, I might be able to change the code to minimize the amount of calls to gotoxy.

KKZiomek
Posts: 7
Joined: 27 Mar 2017 17:57

Re: TaskMon - interactive task monitor/killer

#4 Post by KKZiomek » 26 May 2017 10:54

I have seen many of your projects recently here on dostips. I have a suggestion: if you want to update information in your topics then edit them instead of making new ones.

Besides this, your 3d projects and this task viewer are awesome. One suggestion would be maybe to add a function to be able to open a folder where a running process executable is located?

misol101
Posts: 475
Joined: 02 May 2016 18:20

Re: TaskMon - interactive task monitor/killer

#5 Post by misol101 » 29 May 2017 03:00

KKZiomek wrote:I have seen many of your projects recently here on dostips. I have a suggestion: if you want to update information in your topics then edit them instead of making new ones.

Besides this, your 3d projects and this task viewer are awesome. One suggestion would be maybe to add a function to be able to open a folder where a running process executable is located?

I'm not sure if I can find out the folder but I'll look into it. I'm planning to add external functionality using NirCmd as well, perhaps it can find out the folder a process is using too

misol101
Posts: 475
Joined: 02 May 2016 18:20

Re: TaskMon - interactive task monitor/killer

#6 Post by misol101 » 29 May 2017 13:37

Similar to my listb script, TaskMon can now be extended easily with an external batch file (extendtm.bat)

The extendtm.bat example in the archive below relies on two externals: nircmd and powershell. Since taskmon.bat needs to point to the extension file, it is easiest to launch it with the supplied tm.bat,a shortcut which launches taskmon.bat with the extension file.

Provided that nircmdc.exe (and Powershell.exe for the f key) is in the PATH, running tm.bat enables the following keys (also listed in help):

Code: Select all

F: activate window
t/T: disable/enable window as top-most
^T: set transparency of window
C: set title of window
f: open start folder of executable (not for Services)
P: set task priority

and is easily further extendable by adding to extendtm.bat. Also note that colors can be changed from within extendtm.bat now at the :SETCOLORS label.

(by the way, can somebody help me get the start folder path of Services too (for the 'f' key)? I use powershell.exe Get-Process PROCESSNAME ^| Format-List Path | find "PROCESSNAME" but it doesn't seem to work for Services. )
Attachments
taskmon1_1.zip
(84.9 KiB) Downloaded 414 times

goodorbadash
Posts: 8
Joined: 12 May 2017 06:49
Contact:

Re: TaskMon - interactive task monitor/killer

#7 Post by goodorbadash » 30 May 2017 05:50

This is soooooo much better than mine. I am literally a novice compared to you misol101...

Quite awesome sounding for an idea and I'll try it out soon. :D

PaperTronics
Posts: 118
Joined: 02 Apr 2017 06:11

Re: TaskMon - interactive task monitor/killer

#8 Post by PaperTronics » 14 Jun 2017 07:39

Hey misol! You have an amazing creation there bud!

I wanted to ask your permission to post about this on my website thebateam.org. As you know, I'll give full credits to you and also include the original documentation and file.

PaperTronics

misol101
Posts: 475
Joined: 02 May 2016 18:20

Re: TaskMon - interactive task monitor/killer

#9 Post by misol101 » 14 Jun 2017 09:49

PaperTronics wrote:Hey misol! You have an amazing creation there bud!

I wanted to ask your permission to post about this on my website thebateam.org. As you know, I'll give full credits to you and also include the original documentation and file.

Sure thing!

TaskMon was basically a pretty quick adaptation of Listb, my file explorer: viewtopic.php?t=7147

PaperTronics
Posts: 118
Joined: 02 Apr 2017 06:11

Re: TaskMon - interactive task monitor/killer

#10 Post by PaperTronics » 16 Jun 2017 22:09

Thnx bro! I know about your ListB file explorer, but we already have a similar one on my website, so I can't post about ur file explorer. Sorry bro. :cry:

misol101
Posts: 475
Joined: 02 May 2016 18:20

Re: TaskMon - interactive task monitor/killer

#11 Post by misol101 » 27 Aug 2017 03:21

Another one of my scripts that, when I finally had a chance to run it on a Windows 10 machine, was just disgustingly slow! Not only did it take ~14 seconds to START the script, but navigating was an absolute pain.

The first problem was the Windows tasklist v switch. On this Win10 machine running "tasklist -v" took 12 seconds!

The navigation was just the usual mess of Win 10 excuting external programs vey slow, antivirus program interrupting etc.

So, to deal with this and make it a lot faster, I:
1. Made the whole thing run with servers, with cmdgfx_input for input and cmdgfx for output. Mouse input should be faster too.
2. Removed -v as default when running (it can be switched on by pressing '+' while running)

Unfortunately this version is above the 100k attachment treshold, but I put it on Mediafire here:

http://www.mediafire.com/file/9xxzfbwn4 ... mon1_2.zip

Post Reply