Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Shell 

How to make a command repeat it self till a certain time?

Like
Code
@echo off
:1
echo %random%
goto :1
I want it to happen for a 30 seconds till it stops
something like:
Code
:1
echo %random%
goto :1
timeout /t 30 /nobreak > nul
If I understand what you're asking, try this:
Code
@echo off >nul
Set "var=0"
Set "count=1"

:x
If %var% EQU 30 ( goto :finish
) ELSE (
echo %random%
Set /a var=%var%+%count%
Ping localhost -n 1 >nul
)
goto x

:finish
cls
echo Strings sent successfully!
pause >nul
@exit /B
I don't know exactly 🙃 your aim but try something like that :

PHP Code

<?php 
@echo off
:loop
color 0A
echo %random%
SET /A count=count+1
if %count%==5000 goto finish
goto loop
:Finish
pause
>nul
Exit /b 
(Jul 15, 2016 06:14 PM)StartHearts Wrote:  Like
Code
@echo off
:1
echo %random%
goto :1
I want it to happen for a 30 seconds till it stops
something like:
Code
:1
echo %random%
goto :1
timeout /t 30 /nobreak > nul



Should do what you want. You were about 80% there. You need a loop that adds 1 to a variable each time it fires. Since that loop also includes a 1 sec timer, after 30 iterations exit the loop.

(Written from a phone and untested)
Code
Set num=0
:1
Set /a num=%num%+1
If %num% LEQ 30 (
echo %random%
timeout /t 1 /nobreak > nul
) Else goto finish
goto :1
:finish
Echo done
There's no place like ~/


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by BBGMazeJun 2, 2022 06:17 PM 2 163 Jun 2, 2022 06:17 PM
Last Post: Prisonhack9279
[C] by blackcoder00Mar 17, 2021 01:15 PM 4 163 Mar 17, 2021 01:15 PM
Last Post: Loki123
[Shell] by ImDeepWithWindowsJul 4, 2020 06:19 PM 0 167 Jul 4, 2020 06:19 PM
Last Post: ImDeepWithWindows