diff --git a/modules/juce_events/messages/juce_ApplicationBase.cpp b/modules/juce_events/messages/juce_ApplicationBase.cpp index 66cd07f4b6..f130bf4199 100644 --- a/modules/juce_events/messages/juce_ApplicationBase.cpp +++ b/modules/juce_events/messages/juce_ApplicationBase.cpp @@ -257,6 +257,16 @@ bool JUCEApplicationBase::initialiseApp() } #endif + #if JUCE_WINDOWS && JUCE_STANDALONE_APPLICATION && ! defined (_CONSOLE) + if (AttachConsole (ATTACH_PARENT_PROCESS) != 0) + { + // if we've launched a GUI app from cmd.exe or PowerShell, we need this to enable printf etc. + freopen("CON", "w", stdout); + freopen("CON", "w", stderr); + freopen("CON", "r", stdin); + } + #endif + // let the app do its setting-up.. initialise (getCommandLineParameters());