How do I get the batch to search for another instance 'EBroadcaster1.exe' and to terminate if finds one currently running, to prevent the program from running two instances of itself?
Any help is welcome.
Thank you.
PowershellWindows Batch
Last Comment
Zack
8/22/2022 - Mon
Dr. Klahn
When the program starts:
Check for the existence of "flagfile.txt" in a directory to which it has write access. If it finds the file, exit.
Create the file. No content is necessary; the existence of the file is the flag.
When done processing, delete the file in the closing cleanup code.
This is crude but easy to implement. The problem is that if the program is aborted or terminates abnormally, the flag file remains unless the program catches the abort command and deletes the flag file in the abort handling code.
Check for the existence of "flagfile.txt" in a directory to which it has write access. If it finds the file, exit.
Create the file. No content is necessary; the existence of the file is the flag.
When done processing, delete the file in the closing cleanup code.
This is crude but easy to implement. The problem is that if the program is aborted or terminates abnormally, the flag file remains unless the program catches the abort command and deletes the flag file in the abort handling code.