title: How can I show the console for a Windows GUI application only when it is started from the console?
body: <p>I have a graphical application. When I open the .exe it should not show a console. When I run it from the console I want console output.</p>
  <p>At first, I always got a console window in addition to the application window. I found this annoying, so I set <a href="https://doc.rust-lang.org/nightly/reference/runtime.html#the-windows_subsystem-attribute" rel="nofollow noreferrer"><code>#![windows_subsystem = &quot;windows&quot;]</code></a>. Now the console window is gone when I start the application, but also I don't get any logs when running it from console.</p>
  <p>How can I get both?</p>