@Echo off
rem Info zur Version:
rem Datum              Wer     Info
rem #New: 28.04.2017   J.Fes   ueberarbeitet
rem #LUp: 28.04.2017   J.Fes   Update PrgToRun_ECHO

if "%~2" equ "" (
 Echo.
 Echo ----------------------------------------------------------------------------
 Echo Err: Call: %~0
 Echo Info Para: %*
 Echo Err: missing paramters
 Echo Inf: P1=Prog_N P2=Prog_DPNE
 Echo Example: PlmJobManagerWatchDog starten
 Echo call "ProgIs_Running.cmd" "JobMgr_WatchDog"  JobMgr_WatchDog_isRunning
 Echo Example: with No Echo about result
 Echo call "ProgIs_Running.cmd" "JobMgr_WatchDog"  JobMgr_WatchDog_isRunning EchoOff
 Call ----------------------------------------------------------------------------
 goto :eof
 )
setlocal
 rem -- Rootpfade setzen
 set PrgToRun_N=%~1
 set PrgToRun_ECHO=%~3
 tasklist /FI "IMAGENAME eq %PrgToRun_N%*" 2>nul | findstr /i /c:"%PrgToRun_N%">nul
 set ExeToRun_isRuning=%errorlevel%

 if "%ExeToRun_isRuning%" neq "0" set ExeToRun_isRuningR=0
 if "%ExeToRun_isRuning%" equ "0" set ExeToRun_isRuningR=1

 if /I "%PrgToRun_ECHO%" equ "EchoOff" goto :myEnd

 if "%ExeToRun_isRuningR%" equ "0" Echo Prg is NOT running..............: %PrgToRun_N%
 if "%ExeToRun_isRuningR%" equ "1" Echo Prg is running..................: %PrgToRun_N%

:myEnd
endlocal& set %2=%ExeToRun_isRuningR%
goto :eof
