需求 使用Qt做界面程序的过程中,总会遇到调用其他服务或者脚本的情景,为了解决windows环境下Qt程序中调用.bat脚本,写下了本文。 需要使用 #include <QProcess> #include <QDir> #include <QString> 利用QProcess起一个线程运行.bat脚本; 利用QDir找到脚本的运行路径; 利用QString对路径字符串做操作。 代码实例 #include <QProcess> #