diff --git a/daemon/kdeconnectd.cpp b/daemon/kdeconnectd.cpp index ced324801..bd2447015 100644 --- a/daemon/kdeconnectd.cpp +++ b/daemon/kdeconnectd.cpp @@ -14,6 +14,10 @@ #include #include +#ifdef Q_OS_WIN +#include +#endif + #include #include #include @@ -117,6 +121,14 @@ static void detectPlatform(int argc, char **argv) int main(int argc, char *argv[]) { +#ifdef Q_OS_WIN + // If ran from a console, redirect the output there + if (AttachConsole(ATTACH_PARENT_PROCESS)) { + freopen("CONOUT$", "w", stdout); + freopen("CONOUT$", "w", stderr); + } +#endif + detectPlatform(argc, argv); QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);