Примерное решение:
Код:
![Выделить весь код](images/misc/selectcode.png)
@echo off
setlocal
set "net=HKLM\SYSTEM\CurrentControlSet\Services"
set "net=%net%\Tcpip\Parameters\Interfaces"
:loop
for /f "tokens=3" %%i in (
'reg query %net% /s ^| findstr /irc:"dhcpipaddress"'
) do (
if "%%i" neq "0.0.0.0" (
ping -n 1 127.0.0.1>nul
goto:loop
)
echo:Connection is lost...
rundll32 powrprof.dll,SetSuspendState Sleep
)
endlocal
exit /b