19 gennaio 2013

how check process or application is running with Dos command


I show two simple script:

  • Below check if an application is running:

@echo off
tasklist /FI "IMAGENAME eq process_app.exe" 2>NUL | find /I /N "process_app.exe">NUL
if "%ERRORLEVEL%"=="0" echo Programm is running
if "%ERRORLEVEL%"=="1" echo Programm is not running 
 
  • Below check if a process is running:
@echo off 
tasklist /FI "SERVICES eq process_name" 2>NUL | find /I /N "process_file.exe">NUL
if "%ERRORLEVEL%"=="1" goto Process_NotFound
if "%ERRORLEVEL%"=="0" goto Process_Found 
 
 
Regards

Nessun commento: