Identifying and killing processes

A

_AnonCoward

I want to create a program that can iterate through active processes and
shut down certain applications that are running on a system. I need to
ensure that these processes are not left running overnight and I can't trust
users to do that. As long as I'm in there, I would also like to close all
explorer windows for certain folders.


This is something I've never attempted and I'd appreciate some advice on
where to start. Any suggestions? TIA,


Ralf
 
H

Herfried K. Wagner [MVP]

_AnonCoward said:
I want to create a program that can iterate through active processes and
shut down certain applications that are running on a system. I need to
ensure that these processes are not left running overnight and I can't
trust
users to do that. As long as I'm in there, I would also like to close all
explorer windows for certain folders.

Check out 'System.Diagnostics.Process' and its properties and shared
methods.
 
A

_AnonCoward

: > I want to create a program that can iterate through active processes and
: > shut down certain applications that are running on a system. I need to
: > ensure that these processes are not left running overnight and I can't
: > trust users to do that. As long as I'm in there, I would also like to
: > close all explorer windows for certain folders.
:
: Check out 'System.Diagnostics.Process' and its properties and shared
: methods.
:
: --
: M S Herfried K. Wagner
: M V P <URL:http://dotnet.mvps.org/>
: V B <URL:http://classicvb.org/petition/>


Thanx, will do.


Ralf
 
A

_AnonCoward

:
:
: > I want to create a program that can iterate through active processes and
: > shut down certain applications that are running on a system. I need to
: > ensure that these processes are not left running overnight and I can't
: > trust users to do that. As long as I'm in there, I would also like to
: > close all explorer windows for certain folders.
:
: Check out 'System.Diagnostics.Process' and its properties and shared
: methods.
:
: --
: M S Herfried K. Wagner
: M V P <URL:http://dotnet.mvps.org/>
: V B <URL:http://classicvb.org/petition/>


That was pretty straight forward and not nearly as complicated as I had
expected. I knocked it out in about an hour. The only thing I can't figure
out how to do is shut down the explorer windows. I want to shut down all
such windows *except* the desktop.

Any way to figure out how best to go about that? I suppose I could identify
all the explorer windows and shut down all but the one with the smallest PID
value, but that assumes that the desktop instance will always have the
smallest PID value and I'm not sure that is a reasonable assumption.

And it brings another thought to mind. Should I want to actually see what
folder a given explorer window is pointing to, how would I go about that?
This isn't an actual need on my part but it seems like it could be a useful
thing to know how to do in the future (say, I want to close explorer windows
pointing to certain network shares or something).

Thanx,


Ralf
 

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