Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QProcess fails using Qt5.11x and Windows 7



  • I'm attempting to open a cmd console in Windows using Qt 5.11x. The code fragment below has worked reliably for a long while and continues to work well for Windows 10 and Windows 8x. However, for Windows 7 the cmd console just blinks and goes away.

    I've tried modifying the argument to just call cmd.exe (no .bat file) and also included the full path to cmd.exe, neither change mattered.

    QProcess p;
    p.setProgram("cmd.exe");
    p.setArguments({"/k", QDir::currentPath()+"/cpath.bat"});
    p.setCreateProcessArgumentsModifier([] (QProcess::CreateProcessArguments
    *args) {
            args->flags &= ~CREATE_NO_WINDOW;
        });
    p.startDetached();
    


  • Sorry for the bump, anyone with any thoughts on this issue? I'm stumped as to why this fails using Windows 7...


  • Lifetime Qt Champion

    Hi
    Bump after 2 days is very acceptable.

    I was wondering about it too. I dont have any win 7 to test on, but
    i swear cmd.exe /k used to work.
    Did you test on more than 1 win 7 ?
    Something could be up on that system.
    Also, if you do manually start cmd.exe on the system, it
    does stay open ?



  • Hi. I face the same issue on windows 7. Did you find a solution to the issue?


Log in to reply