0

I need to execute a synchronizing application continuously with a batch file. What I want to do is something like:

while true
   execute application
   sleep 1 minute
end while

Can this be done with CMD?

Thanks in advance.

Ignacio Soler Garcia
  • 21,122
  • 31
  • 128
  • 207
  • See [this question about while-loop-in-batch](http://stackoverflow.com/questions/1788473/while-loop-in-batch) – khachik Dec 21 '11 at 14:59

2 Answers2

3

Using pure batch you could do this:

:LOOP
yourprogram.exe
ping 127.0.0.1 -n 61 >NUL
goto :LOOP

This means you don't have to install any other programs or create more scripts. It might not be pretty but it works! I have pinged 61 times as pinging the loopback seems to create a delayed second.

Bali C
  • 30,582
  • 35
  • 123
  • 152
1

Download unixutils for win32. In here, you will find sleep.exe. Put it somewhere in your path. (frex, in c:\windows)

Then, you can build a batch file similar to this

echo off
:here    
sleep 60s
echo Exec app
rem your app goes here
goto here
Max Lambertini
  • 3,583
  • 1
  • 19
  • 24