I have a Windows Console application that will be running for an extended period of time. This has been developed in house and tests have shown that over time memory usage grows and other bad things ensue. The Developers can't correct all the issues in time for release, so I'm looking for a way to end and restart the process on a periodic basis. I already have a Windows Scheduled task that runs a batch file, checks if the process is running and if not, starts it.
Now I need something that stops it gracefully. The application has commandeered the CTRL-BREAK event as a request for a controlled shutdown. I'd like to send it that CTRL-BREAK and if it still doesn't end after some period of time, then I could use taskkill to end it forcefully. taskkill seems to feed it a CTRL-CLOSE event. Is there some way to feed CTRL-BREAK to a process from the command line?