FOR /f %%i IN ('tasklist^|find /C "dllhost.exe"') DO IF %%i GEQ 6 GOTO :BAD GOTO :GOOD :BAD EXIT /B 1 :GOOD EXIT /B 0