Start Windows Task Manager by command-line (or batch file)

G

Giuseppe R.

Hi to all,
batch file launched by desktop shortcut (WinNT, win2000 e WinXp). Its task
is to do some elaboration if and only if some processes are inactive, that
is if the user had first stopped the application.

Is that possible inside a batch file?
I know executable's names (the same appeared into Windows Task Manager
Processes table), how could I discover if there are active processes with
that name?
And if I would to kill them?

It would be enough to start Windows Task Manager (taskmgr.exe) by
command-line/batch file but I didn't reach it!
It must be possible to do that!
Almost all executables can be launched by shell with some flag to hide their
GUI.
I just need to:
1. start Windows Task Manager inside my batch file
2. list all active processes
3. discover the wanted-processes (if there are...)
4. kill them

Note: I strongly prefer no turn to external program, it would be better to
do all that only with Windows resources, (otherwise I need to install that
program too...)

Thanks in advance, ciao
G.


P.S. Sorry if I post here, if you know a more concerning newsgroup, please
signal it to me.
 
M

Michael Bednarek

[Summary: How to list & stop applications in "WinNT, win2000 e WinXp"]

I don't think the OSs you mention have a common on-board set of tools to
do that; under NT5.1 (XP) or later, there's TASKLIST.EXE and
TASKKILL.EXE. For the others, you might have to use externals. Popular
are the PsTools from Sysinternals (<http://sysinternals.com/>); my
personal preference is 4NT from JPSoft (<http://jpsoft.com/>).

Combining any of the above with FIND (or FFIND in case of 4NT) should
solve your problem.

PS: Don't multipost, crosspost (sensibly).
 
J

Jerold Schulman

Hi to all,
batch file launched by desktop shortcut (WinNT, win2000 e WinXp). Its task
is to do some elaboration if and only if some processes are inactive, that
is if the user had first stopped the application.

Is that possible inside a batch file?
I know executable's names (the same appeared into Windows Task Manager
Processes table), how could I discover if there are active processes with
that name?
And if I would to kill them?

It would be enough to start Windows Task Manager (taskmgr.exe) by
command-line/batch file but I didn't reach it!
It must be possible to do that!
Almost all executables can be launched by shell with some flag to hide their
GUI.
I just need to:
1. start Windows Task Manager inside my batch file
2. list all active processes
3. discover the wanted-processes (if there are...)
4. kill them

Note: I strongly prefer no turn to external program, it would be better to
do all that only with Windows resources, (otherwise I need to install that
program too...)

Thanks in advance, ciao
G.


P.S. Sorry if I post here, if you know a more concerning newsgroup, please
signal it to me.


See tip 7187 in the 'Tips & Tricks' at http://www.jsiinc.com


Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top