Search code examples
c++qtqprocess

How to run a windows cmd command using Qt?


I have to run the following command using Qt, which will pop up the Git GUI window.

D:\MyWork\Temp\source>git gui

How do I do that?

I tried the following, but it didn't work:

QProcess process;   
process.start("git gui",QStringList() << "D:\MyWork\Temp\source>");

Solution

  • I solved my problem using following simple code segment

    #include <QDir>
    
    QDir::setCurrent("D:/MyWork/Temp/source");
    system("git gui");