not sure what the best way here is let it leak  it will eventually finish terminate it dead  that s what i did here send wm close window may prompt the user for confirmation  we do not really want that  the use case here is things like doing some background network pinging etc  user has no idea what is running console apps seem to not do what you expect here the default behaviour will kill the console window without affecting the  main  process of the app if you wanted to act on a failed attempt with a heavy handed terminateprocess  you need to block even longer or delay stuff on the event loop  we do not want to do either here generateconsolectrlevent  you cannot control the process group this signal is sent to  it goes to  everybody  in the calling process  group  that s bad  very bad  i guess the only intended use case is when a dying process wants to warn it is children  i could use if i launched a subprocess inside a process group that then launched the command  that seems wasteful  and wee bit non trivial 