Reputation: 1013
As task scheduler doesn't seem to be stopping me from running 2 instances, I have already enabled do not start a new instances
Upvotes: 0
Views: 215
Reputation: 31231
Presuming you are actually asking for a batch solution rather than a Java one, and provided that you are starting the Java programs from the batch then you could do something like this
tasklist /nh /fi "imagename eq java.exe" | find /i "java.exe" >nul && (
echo Java already running, not going to run again
) || (
echo Java not running, so run it
java.exe whatever
)
Obviously you will have to replace java.exe whatever
with your actual command.
If this isn't what you are looking for please add more specific info/requirements.
Upvotes: 1