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. QProcess won't start executable on Windows
Forum Updated to NodeBB v4.3 + New Features

QProcess won't start executable on Windows

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 311 Views 2 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.
  • S Offline
    S Offline
    Sucharek
    wrote on last edited by
    #1

    Hi, so I have a problem with QProcess, because it doesn't want to start an executable.
    I've checked paths, tried multiple things, but nothing worked so far...
    Here's what I have right now:

    #include <QCoreApplication>
    #include <QProcess>
    #include <QDebug>
    
    int main(int argc, char *argv[])
    {
        QCoreApplication a(argc, argv);
    
        QProcess startServer;
        startServer.setWorkingDirectory("C:/Users/janso/Desktop/more/WSL_GUI");
        startServer.start("cmd /C", QStringList("Window.xlaunch"));
        startServer.waitForFinished();
        qDebug() << startServer.readAll(); //prints ""
    }
    

    No output whatsoever.

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by Christian Ehrlicher
      #2

      @Sucharek said in QProcess won't start executable on Windows:

      "cmd /C"

      This is wrong - there is no command cmd /C, just a command cmd which takes /C as first argument.

      /edit: and if Window.xlaunch is really a executable then there is no need to execute it through cmd at all - it should be started directly then instead.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      S 1 Reply Last reply
      4
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi
        You seem not to point to an exe for it to execute ?

        what is Window.xlaunch ?

        1 Reply Last reply
        0
        • Christian EhrlicherC Christian Ehrlicher

          @Sucharek said in QProcess won't start executable on Windows:

          "cmd /C"

          This is wrong - there is no command cmd /C, just a command cmd which takes /C as first argument.

          /edit: and if Window.xlaunch is really a executable then there is no need to execute it through cmd at all - it should be started directly then instead.

          S Offline
          S Offline
          Sucharek
          wrote on last edited by
          #4

          Hi @Christian-Ehrlicher, that solved it. Thank you :)

          1 Reply Last reply
          0

          • Login

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