close dos shell upon exit

by Banks1850 at 2012-10-16 08:27:07

hello all, I’m attempting to close a process that runs in a dos shell (I have no control over that aspect).
let’s call them the control window (which starts and stops the process and monitors it for a reason to restart it) and the process window( which actually runs the process).

I am looking for a way to close the process window so I can restart it again without having multiple dos windows hanging around. I’m looking to do this from the control window.

Anyone have a way to do this?


-Steve H.
by DonJ at 2012-10-18 07:45:50
Get the process ID of the window and use Stop-Process. Having the OS kill the process will close the window. If you use Start-Process to start the thing, you’ll get the process ID from that.