Unsolved close/kill another Windows process which is started by run a .bat in Qt app
-
any way to close/kill another Windows process which is started by run a .bat in Qt app?
-
@opengpu I guess you're using QProcess (you did not say how you're starting the process).
If so what about:- https://doc.qt.io/qt-5/qprocess.html#close
- https://doc.qt.io/qt-5/qprocess.html#kill
- https://doc.qt.io/qt-5/qprocess.html#terminate
?
-
@opengpu
Provided you mean the Windows process started from the BAT responds to the BAT being terminated then as @jsulm says you should be able to terminate it by terminating theQProcess
used to launch the BAT. However, if the sub-process has "gone interactive" and the BAT file is not waiting for it (e.g. runnotepad.exe
orstart
from a BAT), you will have to find the sub-process and kill that (e.g.taskkill.exe
,EnumProcesses
).