title: Is there a way for a windows-subsystem application to offer optional console output?
body: <p>I have a Windows application application that is normally GUI-only and declares the WINDOWS subsystem. It doesn't open a console window when launched.</p>
  
  <p>Alas, I would like to offer additional console output when the application happens to be started from console window (say, from interactive cmd.exe).</p>
  
  <p>Is there a way of detecting if some process "up the chain" has an open console, and to attach to that console?</p>
  
  <p>The closest I've found is <a href="http://www.halcyon.com/~ast/dload/guicon.htm" rel="nofollow">a way to explicitly open a console for a gui application</a>, but I don't want to open a console if there isn't one already there.</p>