Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Windows cmd.exe startDetached fails

Windows cmd.exe startDetached fails

Scheduled Pinned Locked Moved Solved General and Desktop
startdetached 5qt 5.10.1cmd.exe
4 Posts 3 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jedd
    wrote on last edited by
    #1

    I recently updated from Qt 5.6 to Qt 5.10.1 and the function below now fails to work. Windows console is not opened when the function is called. I rechecked with a recompile using 5.6 and the function works fine. Why does this code work with 5.6 and previous releases and not with Qt 5.10.1?

     void MainWindow::on_doConsole_clicked()
     {
    
        QString commstr = adbdir+"cpath.bat";
        QFile file(commstr);
    
            if(!file.open(QFile::WriteOnly |
                      QFile::Text))
            {
                logfile("error creating cpath.bat!");
                QMessageBox::critical(this,"","Error creating bat file!");
                return;
            }
    
            QTextStream out(&file);
            out  << "set PATH=%PATH%;"+QDir::currentPath()+";"<< endl;
    
            file.flush();
            file.close();
    
            cstring = "cmd /k " +QDir::currentPath()+"/cpath.bat";
            QProcess::startDetached(cstring);
    

    }

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Please read the part of the QProcess documentation about CreateProcessArgumentModifier.

      It'll show you have to handle your use case.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • aha_1980A Offline
        aha_1980A Offline
        aha_1980
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi @Jedd,

        you find more information to your problem at QTBUG-57687

        Regards

        Qt has to stay free or it will die.

        J 1 Reply Last reply
        3
        • aha_1980A aha_1980

          Hi @Jedd,

          you find more information to your problem at QTBUG-57687

          Regards

          J Offline
          J Offline
          Jedd
          wrote on last edited by
          #4

          @aha_1980 Thank you for the link.

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved