How can I check if an application is running from a batch (well cmd) file?
I need to not launch another instance if a program is already running. (I can't change the app to make it single instance only.)
Also the application could be running as any user.
Best Answer
Another possibility I came up with, which does not require to save a file, inspired by using grep is:
/fi ""
defines a filter of apps to find, in our case it's the *.exe name/fo csv
defines the output format, csv is required because by default the name of the executable may be truncated if it is too long and thus wouldn't be matched byfind
later.find /I
means case-insensitive matching and may be omittedSee the man page of the tasklist command for the whole syntax.