QString KillStr = "taskkill /f /im main.exe"
QProcess *Process = new QProcess(this)
Process->start(KillStr)
启动
QString filepath = QDir::currentPath()
QString fullpath = filepath+"\\pp\\dist\\start"
QString title = fullpath+"\\main.exe"
title = title.replace("/","\\")
fullpath = fullpath.replace("/","\\")
QProcess p(this)
p.setWorkingDirectory(fullpath)
p.start("cmd", QStringList()<<"/c"<<"start main.exe")
p.waitForStarted()
p.waitForFinished()
关闭
QProcess p(this)
p.setWorkingDirectory(fullpath)
p.start("cmd", QStringList()<<"/c"<<"taskkill /f /t /im main.exe")
p.waitForStarted()
p.waitForFinished()
1、写个 txt 文件,比如,autuo_shut,其内容有两行如下:【开机执行的原来那个命令】
init 0
2、把你开机执行的原来那个命令换成“sh autuo_shut”。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)