参考
- https://blog.csdn.net/vample/article/details/78872587
- https://blog.csdn.net/liuyukuan/article/details/5974517
环境
环境 | 版本 |
---|---|
windows | 10 |
QT | 6.2.4 |
Qt Creator | 8.0.1 (Community) |
qmake |
代码
/**
* @brief LoadWamp::testCmd
* 检测CMD命令执行
*/
QProcess process(this);
process.setProgram("cmd");
//
QStringList argument;
argument << "/c" << " arp -a";
//
process.setArguments(argument);
process.start();
process.waitForStarted(); //等待程序启动
process.waitForFinished();//等待程序关闭
QByteArray qbt = process.readAllStandardOutput();
QString msg = QString::fromLocal8Bit(qbt);
qDebug() << msg;