I have been struggling with a batch file for a while now and I was wondering if you can help.
I need to find out if an application is running. The application is a C# console app housed in the folder
I have the following .bat file which sort of works.
tasklist /FI "IMAGENAME eq Portal.Console.Integrate.exe" 2>NUL
if "%ERRORLEVEL%"=="0" (
echo Program is Running
) else (
echo Program is not running
However, the error level always return as 0 irrespective of the application running or not?
It does detect the process is running and prints out the process info and it also detects if the app isn't running but still prints "Program is running"
Can anyone help?