:repeat
setlocal enabledelayedexpansion
set ip=192.168.1.205
set t=2
:#
ping -4 -n 1 %ip%| find/i "TTL="&& goto #
:##
ping -4 -n 2 %ip%| find/i "TTL="&& (goto #& set n=)|| (
set/a n+=1& if !n! lss %t% (goto ##) else (C:\Program Files\Oracle\VirtualBox\VBoxManage.exe startvm Cloud --type headless)
)
TIMEOUT /T 600 /NOBREAK
goto :repeat
endlocal
@echo off
SETLOCAL EnableDelayedExpansion
:beginloop
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" list runningvms | FINDSTR Cloud
if %errorlevel% EQU 0 (
echo Is running
) else (
echo VM is not running, tryint to start:
rem C:\Program Files\Oracle\VirtualBox\VBoxManage.exe startvm Cloud --type headless
)
timeout /T 60 /NOBREAK
goto :beginloop