Say I have several conhost processes that happen to be running already. Now I run a batch file, which starts a cmd
process which, in turn, causes another conhost process to open up. From within the batch file
- I know I can get the PID of that batch file's cmd process, but
- I don't know how to get the
PID
of the associated conhost process.
My goal is to be able to close down all the other conhost processes that were running previously (or possibly after the batch file was run) and not close the conhost associated with the very batch file and cmd.exe
doing all the closing. If that conhost gets closed, so will its cmd
process and the batch file will end prematurely (I want it to do other things after that).
This is not a duplicate of the question asked in the link above. That question only dealt with getting the pid
of the cmd
, not the associated conhost PID
.