Friday, 28 September 2012

How to determine if a process is running in a DOS batch file

 

Trick is to use tasklist.exe and pipe the output through a find then check the errorlevel as follows...

tasklist /FI "IMAGENAME eq WebDev.WebServer40.exe" 2>NUL | find /I /N "WebDev.WebServer40.exe">NUL
if "%ERRORLEVEL%"=="0" GOTO START
echo. Starting web app dev server
call sw.bat

:START

No comments:

Post a Comment

Inline Images not showing for Work Items in Visual Studio with 401 unauthorized error

To fix this, right click the broken image link from the Visual studio work item description pane, then copy the link from the properties dia...