1.

Solve : Check if a process exists. If don't exist execute?

Answer»

Check if a process exists. If don't exist execute

I would like a script to launch several processes in the case of any of them is not running.

By example :

notepad.exe
controlQ.ahk
etc.

Best Regards
tasklist | find "notepad.exe" >nul
if "%ERRORLEVEL%"=="1" notepad.exe


This does not work for batch files or other scripts. Quote from: Lemonilla on September 23, 2014, 09:43:38 AM

tasklist | find "notepad.exe" >nul
if "%errorlevel%"=="1" notepad.exe


This does not work for batch files or other scripts.

And something THA may help with bat files or other scripts ?
Best Regards
You cannot.  They appear on the system as instances of cmd.exe.How can i automate then to see is a process is running or not with a script. And if is not running, run it.

Best Regards
Quote from: Lemonilla on September 23, 2014, 09:43:38 AM
tasklist | find "notepad.exe" >nul
if "%errorlevel%"=="1" notepad.exe


This does not work for batch files or other scripts.
I use this
Code: [Select]tasklist /fi "Imagename eq link.exe" 2>NUL | find /i /n "link.exe">NUL
if "%ERRORLEVEL%"=="1" (goto D) else (goto B)
first make a batch file than convert it to exe so I named it link.exe
you must be carefull how you name it because some antivirus software can make you a trouble.

to CONVERTING to exe I use "bat to exe CONVERTER" Quote from: Blisk on September 29, 2014, 01:21:04 AM
first make a batch file than convert it to exe so I named it link.exe
you must be carefull how you name it because some antivirus software can make you a trouble.

to converting to exe I use "bat to exe converter"
Why do you even mention this?  It has nothing to do with the original question.  Nor does it help the OP solve their problem.


Discussion

No Comment Found