1.

Solve : Repeatedly run command in windows?

Answer»

I am looking for a WAY to repeatedly run a command where the command is run, and then the computer waits for the command to finish before running it again. (That is, SOMETHING similar to the "while true; do ... ; done" in linux.) I have tried creating a batch file like this:
Code: [Select]:A
command
@ GOTO A
But when I tried that it wouldn't wait for the first issuance of the command to finish before it ran the command again.

I'm hoping for an easy way to do this, but maybe there isn't one in windows.Try looking at START /? at the command prompt. The /wait part you may be interested in. Nope, putting START /WAIT in there doesn't work? do you have any other IDEAS?What command are you trying to execute? What is the full syntax?Code: [Select]@echo off

set /a c=0
:here
echo Sleep 3 seconds and repeat
echo when COUNT is 10 quit
echo count = %c%
C:\batextra\sleep.exe 3

set /a c+=1

if %c% EQU 10 exit /b

goto here
Output:

C:\>reploop.bat
Sleep 3 seconds and repeat
when count is 10 quit
count = 0
Sleep 3 seconds and repeat
when count is 10 quit
count = 1
Sleep 3 seconds and repeat
when count is 10 quit
count = 2
Sleep 3 seconds and repeat
when count is 10 quit
count = 3
Sleep 3 seconds and repeat
when count is 10 quit
count = 4
Sleep 3 seconds and repeat
when count is 10 quit
count = 5
Sleep 3 seconds and repeat
when count is 10 quit
count = 6
Sleep 3 seconds and repeat
when count is 10 quit
count = 7
Sleep 3 seconds and repeat
when count is 10 quit
count = 8
Sleep 3 seconds and repeat
when count is 10 quit
count = 9

C:\>



Discussion

No Comment Found