Answer the question
In order to leave comments, you need to log in
How to make ping in cmd every 5 minutes?
Good evening.
there is a code
: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
Answer the question
In order to leave comments, you need to log in
Added before ping -4 -n 1 %ip%| find/i "TTL="&& goto # string TIMEOUT /T 300 /NOBREAK.
1. Download/create a console runtime delay utility.
2. Use the assigned task manager.
Here are all the ways.
Why ping?
@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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question