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: launching a new terminal (cmd.exe) from QProcess
Qt 6.11 is out! See what's new in the release blog

Windows: launching a new terminal (cmd.exe) from QProcess

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 4.5k 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.
  • C Offline
    C Offline
    cidadao
    wrote on last edited by
    #1

    Hello,

    How can I launch (and see) a new terminal through QProcess?
    I can do something like this:

    args << "/C"  << workDir + updater_exe << "--install-path" << "../";
    QProcess::startDetached("cmd", args, workDir)
    

    And it works . In the background, so I never get to see the terminal and the messages that should be printed on it.
    On a "cmd.exe" one may start another terminal by issuing the command "start cmd.exe". But I'm unable to do the same through QProcess. I can't start the program by using "start" preceding it.

    Any suggestions?

    FlotisableF jsulmJ D 3 Replies Last reply
    0
    • C cidadao

      Hello,

      How can I launch (and see) a new terminal through QProcess?
      I can do something like this:

      args << "/C"  << workDir + updater_exe << "--install-path" << "../";
      QProcess::startDetached("cmd", args, workDir)
      

      And it works . In the background, so I never get to see the terminal and the messages that should be printed on it.
      On a "cmd.exe" one may start another terminal by issuing the command "start cmd.exe". But I'm unable to do the same through QProcess. I can't start the program by using "start" preceding it.

      Any suggestions?

      FlotisableF Offline
      FlotisableF Offline
      Flotisable
      wrote on last edited by
      #2

      @cidadao
      maybe you should write a terminal widget yourself, and communicate with cmd.exe to get the output and print in your widget?

      or try to call the cmd.exe by cmd.exe?

      the reason you can't "start cmd.exe" may be described in the document

      1 Reply Last reply
      2
      • C cidadao

        Hello,

        How can I launch (and see) a new terminal through QProcess?
        I can do something like this:

        args << "/C"  << workDir + updater_exe << "--install-path" << "../";
        QProcess::startDetached("cmd", args, workDir)
        

        And it works . In the background, so I never get to see the terminal and the messages that should be printed on it.
        On a "cmd.exe" one may start another terminal by issuing the command "start cmd.exe". But I'm unable to do the same through QProcess. I can't start the program by using "start" preceding it.

        Any suggestions?

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @cidadao Did you try to start cmd.exe without /C?
        @Flotisable The link you posted does not explain the problem as it is talking about commands which are built-in incmd.exe. cmd.exe itself is an executable and can be started using QProcess.

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        FlotisableF 1 Reply Last reply
        0
        • jsulmJ jsulm

          @cidadao Did you try to start cmd.exe without /C?
          @Flotisable The link you posted does not explain the problem as it is talking about commands which are built-in incmd.exe. cmd.exe itself is an executable and can be started using QProcess.

          FlotisableF Offline
          FlotisableF Offline
          Flotisable
          wrote on last edited by Flotisable
          #4

          @jsulm
          as far as I know, start is a build-in command of cmd.exe, so that's why I post the link.

          jsulmJ 1 Reply Last reply
          2
          • FlotisableF Flotisable

            @jsulm
            as far as I know, start is a build-in command of cmd.exe, so that's why I post the link.

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @Flotisable Sorry, didn't notice start before cmd.exe

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • C cidadao

              Hello,

              How can I launch (and see) a new terminal through QProcess?
              I can do something like this:

              args << "/C"  << workDir + updater_exe << "--install-path" << "../";
              QProcess::startDetached("cmd", args, workDir)
              

              And it works . In the background, so I never get to see the terminal and the messages that should be printed on it.
              On a "cmd.exe" one may start another terminal by issuing the command "start cmd.exe". But I'm unable to do the same through QProcess. I can't start the program by using "start" preceding it.

              Any suggestions?

              D Offline
              D Offline
              Devopia53
              wrote on last edited by
              #6

              @cidadao

              like this:

              args << "/C" << "start" << workDir + updater_exe << "--install-path" << "../";
              QProcess::startDetached("cmd", args, workDir);
              
              
              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