bool bIsExist = false; // 进程是否存在 QProcess process; process.start("tasklist.exe"); if (process.waitForFinished()) { QByteArray result = process.readAll(); QString exe = QString(result); if (exe.contains(strProcessName)) { bIsExist = true; // 找到了 } } process.close(); //结束进程 QStringList list; list << "/im" << strProcessName << "/f"; QProcess::execute(QLatin1String("taskkill"), list);
原文:https://www.cnblogs.com/tingtaishou/p/14744400.html