Launch Program if Specific Instance isn't already running

by bludeuce   Last Updated January 12, 2018 21:01 PM

I'm trying to use Tasklist in Powershell or Command Prompt to look at my tasklist and determine if a program is running. If it isn't then I need to launch the program, if it is then no further action. I've figured out how to find the application, but how do I make a decision & take action based on whether or not it finds something. I've found other examples that use"IMAGENAME" instead of "WINDOWTITLE", but there are multiple instances of this application running & I need to check for a specific one.

PS C:\Users> tasklist /FI "WINDOWTITLE eq Grain*"

Image Name PID Session Name Session# Mem Usage

========================= ======== ================ =========== DisplayClient.exe 608 Console 3 63,048 K PS

So this works to find the application in question. I just need to take action based on this result.

Tags : windows-10

Related Questions

Migrate from windows server os to desktop

Updated July 02, 2015 15:00 PM