Hi all,
How to use batch file to check if an application still running or not? If the application still running, this process will loop again and again. Else, there will be error message.
Thank you very much
Hi all,
How to use batch file to check if an application still running or not? If the application still running, this process will loop again and again. Else, there will be error message.
Thank you very much
Perhaps you mean tasklist? You can run that from the command line to get all running processes in windows...for the rest of what you are asking I think you will need to be more specific.
Linux ?
ps aux | grep task | wc -l
where task is the name of the task (e.g. "apache2" - quotes not needed)
Hi, in windows you kan use pstools pslist to check if a process name is running by using a .cmd script like the following. Pslist will return ERRORLEVEL 0 if the process is running, 1 if not.
@echo off
CommandYouWillRun.exe
rem waiting for the process to start
:startcmd
sleep 1
c:\path\to\pslist.exe CommandYouWillRun > NUL
IF ERRORLEVEL 1 goto startcmd
rem the process has now started
:waitforcmd
sleep 1
c:\path\to\pslist.exe CommandYouWillRun > NUL
IF ERRORLEVEL 1 got finished
goto waitforcmd
:finished
echo "This is an error message"
You can write a powershell-script and use get-process with filtering.
http://www.computerperformance.co.uk/powershell/powershell_process.htm