0

I have a bunch of processes on a server that I want to update the exes regurlary. But before update they must be closed and I use PsKill for that in a bat-file. It works but I seek a way to only send a "Quit Query" to the processes so it shuts down more properly. With PsKill it is done by force.

How can this be done ?

2
  • I don't think we can answer this without knowing which processes. You probably need to contact the developer of the process to find out how to do this.
    – user9517
    Jul 19, 2011 at 7:54
  • Barbaric! If your executable needs to be shut down prior to an upgrade you should have it respond to an appropriate command, not brutally and rudely kill it like that, which can result in system instability that you'll have no end of trouble debugging. Jul 20, 2011 at 2:59

1 Answer 1

2

When talking about executables on a server I assume you are talking about services.

If so, you can stop them using "net stop " i.e. "net stop certsvc", otherwise if the executables run in interactive mode, e.g. in a console session and have a window you can use the Windows API to find the application's window and send WM_SYSCOMMAND with SC_CLOSE as parameter.

Here is an example: http://www.codeproject.com/KB/dialog/closewindow.aspx.

2
  • That's some creative thinking there. I was about to write an answer just stating "It can't be done", but I've leart something today :) Jul 20, 2011 at 0:31
  • In this case it was an ordinary window with GUI. But of course you are right. It can be done with a little program that call WinAPI.
    – berocoder
    Jul 21, 2011 at 6:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .