其他分享
首页 > 其他分享> > Qt: 执行cmd命令;

Qt: 执行cmd命令;

作者:互联网

    QProcess p(NULL);
    p.setWorkingDirectory(szAppPath+"/database");           //指定工作路径,这个地方一定要设置;
    p.start(szCmd);                        //开进程执行命令;
    while(p.state() != QProcess::NotRunning)                    //延时;
    {
        QTime delayTime = QTime::currentTime().addMSecs(100);
        while( QTime::currentTime() < delayTime)
           QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
    }            

  

标签:QTime,Qt,currentTime,cmd,QProcess,命令,while,delayTime,100
来源: https://www.cnblogs.com/yinwei-space/p/10683260.html