static void runCmdTools(const QString& cmd){ QProcess p; p.start("cmd", QStringList() << "/c" << cmd);//p.startDetached("cmd", QStringList() << "/c" << cmd) p.waitForFinished(); p.close(); }
读取执行CMD返回的值
static QString readCmdContent(const QString& cmd) { QProcess p; p.start(cmd)); if(!p.waitForFinished()) return NULL; QString tmp; QString info = tmp.prepend(p.readAll()); p.close(); return info; }
Qt 执行CMD命令
最新推荐文章于 2024-03-09 22:43:36 发布