Another possibility I came up with, which does not require to save a file, inspired by using grep is:
tasklist /fi "ImageName eq MyApp.exe" /fo csv 2>NUL | find /I "myapp.exe">NUL
if "%ERRORLEVEL%"=="0" echo Program is running
/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 omitted
See the man page of the tasklist command for the whole syntax.