Qt 4.3 QProcess(CMD)



  • Hallo, wie kann ich mit QProcess die CMD ansteurn. Ich möchte einen Ordner mit Unterordner von C:\ nach D:\ verschieben.

    CMD Befehl = xcopy /e /i /y "sourcePath" "targetPath"



  • Hallo, ist an sich ganz easy, in dem Beispiel parse ich df -h, du kannst das einfach anpassen.

    QString cmd("df");
       readPartition = new QProcess(this);
       readPartition->start(QFile::encodeName(cmd).data(), QStringList() << "-h");
       if (!readPartition->waitForFinished()) {
          QMessageBox::warning(this, tr("Error"), tr("Could not allocate disk space\n"));
          return;
       }
    
       QString line = readPartition->readAll();
       if (line == NULL) {
          QMessageBox::warning(this, tr("Error"), tr("Could not read data stream\n"));
          return;
       }
    

    http://doc.trolltech.com/4.3/qprocess.html


Anmelden zum Antworten