Qt World Summit: Register Today!

QProcess not kill when running windows batch file

  • I am running one windows batch file using as

    @echo off :loop taskkill /im "app.exe" /fi "STATUS eq NOT RESPONDING" /f >nul && start "" "C:\Program Files\app\app.exe" goto loop

    this will start application when it is not responding. I am running this batch file using qt application as

    QProcess *process= new QProcess(this);
    process->start("cmd.exe", QStringList() << "/c"<<"C:/Users/test.bat");

    i am killing the process using process->kill() in application close Event. But the process not get closed, it continuously running the batch file. Is there way to kill process properly?

  • Lifetime Qt Champion

    kill() should do it but who is calling kill ?
    The app that says "not responding?"
    and did you check that the closeEvent is seen when app is task-killed ?

Log in to reply