Auto-kill running process if a specified process is not running, otherwise let it run?
#1 Guest_AnonVendetta_*
Posted 04 March 2020 - 09:09 AM
1. Starts launcher process
2. Launcher process starts subprocess
3. Scans for a specific process, and allows that process's launcher exe to remain running if true
4. If false and the launched process isnt running, I would like to autokill that process's launcher exe
It is 2 processes in total, but the 2nd wont run if it detects the 1st process isnt running. I just am looking for an easy, scriptable solution. Ideally it (the bat/cmd) will poll once per minute, kill the launcher process if its' subprocess is no longer running, then cleanly exit.
Thanks!
#2
Posted 04 March 2020 - 10:25 AM
Basically you need:
tasklist
https://ss64.com/nt/tasklist.html
taskkill
https://ss64.com/nt/taskkill.html
timeout
https://ss64.com/nt/timeout.html
The issue - generally speaking - with doing this in batch is that timeout or sleep or ping consume processor cycles.
Maybe you could try using the task scheduler (schtasks) directly or through soon.exe (win2K resource Kit), but AFAICR each version of Windows is slightly different (if it is Windows you are asking about), Nirsoft's ATnow should be easier:
https://www.nirsoft....tils/atnow.html
Wonko
#3
Posted 05 March 2020 - 10:51 AM
Can the actual app work if it is invoked from another program while the launcher run in background ?
Can you configure the launcher not to run the actual app automatically ?
If both are yes, a simple batch file like this may work.
launchername.exe
start /wait "" appname.exe
taskkill /im launchername.exe
#4 Guest_AnonVendetta_*
Posted 11 March 2020 - 11:33 PM
I'm looking into Wonko's suggested solution, it should be enough. Since my only need is to auto kill the launcher if its' subprocess isn't running.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users