:F net start | find "PnkBstrA" goto PA%ERRORLEVEL% :PA0 set PNKA=1 goto testAdone :PA1 set PNKA=0 goto testAdone :testAdone net start | find "PnkBstrB" goto PB%ERRORLEVEL% :PB0 set PNKB=1 goto testBdone :PB1 set PNKB=0 goto testBdone :testBdone set /A PNKSUM=%PNKA%+%PNKB% rem Neither of the Punkbuster services are running so start them if %PNKSUM% EQU 0 goto 1punkstart rem One or both of the Punkbuster services are running so stop them if %PNKSUM% GTR 0 goto 1punkstop goto endbatch :1punkstart echo Starting PnkBstrA Service... NET START PnkBstrA echo Starting PnkBstrB Service... NET START PnkBstrB goto endbatch :1punkstop if %PNKA% EQU 0 goto skipstopA echo Stopping PnkBstrA Service... NET STOP PnkBstrA :skipstopA if %PNKB% EQU 0 goto skipstopB echo Stopping PnkBstrB Service... NET STOP PnkBstrB :skipstopB goto endbatch :endbatch rem cleanup environment variables used when testing for services set PNKA= set PNKB= set PNKSUM= ping localhost > nul ping localhost > nul ping localhost > nul ping localhost > nul Goto F