@ECHO OFF SETLOCAL ENABLEEXTENSIONS SET BaseRAnge=192.168.1 SET Min=100 SET Max=115 :loop SET Counter=0 FOR /L %%A IN (%Min%,1,%Max%) DO ( ECHO Pinging %BaseRange%.%%A PING -n 1 %BaseRange%.%%A >nul 2>&1 &&SET /A Counter+=1 ) IF %Counter% LEQ 1 ( ECHO Successful ping %Counter% rundll32.exe powrprof.dll,SetSuspendState 0,1,0 ) ELSE ( REM Poorman's WAIT REM Very roughly 60 second intervals REM it would be much better to use AT, SCHTASKS or any of the n third party "WAIT" tools FOR /L %%B in (0,1,4100) DO PING -n 1 127.0.1.1>nul GOTO :loop ) that crushes my crashes my cmd:(