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. How to run windows cmd command
Forum Updated to NodeBB v4.3 + New Features

How to run windows cmd command

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 339 Views
  • 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.
  • E Offline
    E Offline
    ekato993
    wrote on last edited by
    #1
    void MainWindow::on_pushButton_videoFormatConverter_clicked()
    {
        QStringList inputPaths = QFileDialog::getOpenFileNames();
    
        
        int outputIndex = inputPaths[0].lastIndexOf('/');
        QString outputPath = inputPaths[0].left(outputIndex + 1);
        outputPath.replace(QChar('\\'),QChar('/'));
    
    
        QString makeFolder = "mkdir \"" + outputPath + "outputs\"";
        QString ffmpegCode = //ffmpeg code get input parameters from QStringList inputPaths and output to the outputs folder
    
    
        qDebug().noquote() << makeFolder;
        qDebug().noquote() << ffmpegCode;
    
    
        QProcess process;
        process.execute(makeFolder);
        process.execute(ffmpegCode);
       
    
    }
    

    I would like to run the following ffmpeg code:

    mkdir outputs
    //ffmpeg code
    

    The input parameters are correct (makeFolder, ffmpegCode).

    The code is basically convert video format to .mkv format.

    KroMignonK JonBJ 2 Replies Last reply
    0
    • E ekato993
      void MainWindow::on_pushButton_videoFormatConverter_clicked()
      {
          QStringList inputPaths = QFileDialog::getOpenFileNames();
      
          
          int outputIndex = inputPaths[0].lastIndexOf('/');
          QString outputPath = inputPaths[0].left(outputIndex + 1);
          outputPath.replace(QChar('\\'),QChar('/'));
      
      
          QString makeFolder = "mkdir \"" + outputPath + "outputs\"";
          QString ffmpegCode = //ffmpeg code get input parameters from QStringList inputPaths and output to the outputs folder
      
      
          qDebug().noquote() << makeFolder;
          qDebug().noquote() << ffmpegCode;
      
      
          QProcess process;
          process.execute(makeFolder);
          process.execute(ffmpegCode);
         
      
      }
      

      I would like to run the following ffmpeg code:

      mkdir outputs
      //ffmpeg code
      

      The input parameters are correct (makeFolder, ffmpegCode).

      The code is basically convert video format to .mkv format.

      KroMignonK Offline
      KroMignonK Offline
      KroMignon
      wrote on last edited by
      #2

      @ekato993 said in How to run windows cmd command:

      I would like to run the following ffmpeg code:
      mkdir outputs
      //ffmpeg code

      The input parameters are correct (makeFolder, ffmpegCode).
      The code is basically convert video format to .mkv format.

      Why do you not use QDir::mkpath() to create directory?
      So you can verify is directory creation was successfull.

      It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

      1 Reply Last reply
      3
      • E ekato993
        void MainWindow::on_pushButton_videoFormatConverter_clicked()
        {
            QStringList inputPaths = QFileDialog::getOpenFileNames();
        
            
            int outputIndex = inputPaths[0].lastIndexOf('/');
            QString outputPath = inputPaths[0].left(outputIndex + 1);
            outputPath.replace(QChar('\\'),QChar('/'));
        
        
            QString makeFolder = "mkdir \"" + outputPath + "outputs\"";
            QString ffmpegCode = //ffmpeg code get input parameters from QStringList inputPaths and output to the outputs folder
        
        
            qDebug().noquote() << makeFolder;
            qDebug().noquote() << ffmpegCode;
        
        
            QProcess process;
            process.execute(makeFolder);
            process.execute(ffmpegCode);
           
        
        }
        

        I would like to run the following ffmpeg code:

        mkdir outputs
        //ffmpeg code
        

        The input parameters are correct (makeFolder, ffmpegCode).

        The code is basically convert video format to .mkv format.

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #3

        @ekato993
        Use internal QDir::mkpath() to create a directory, no point running a mkdir command, as @KroMignon said.

        For the ffmpeg you need to use whatever the command-line is to run that, with appropriate parameters, and across multiple files, if it accepts that. We don't know what that command line needs to look like. Practice it from a Command Prompt till you get it right, then you're ready to pass it to QProcess.

        Note that QProcess::exexcute() is static, so if you use that it it is misleading to declare a QProcess process;.

        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