如何使用CMD连续执行应用程序?

时间:2011-12-21 14:57:03

标签: shell cmd execute

我需要使用批处理文件连续执行同步应用程序。我想做的是:

while true
   execute application
   sleep 1 minute
end while

可以用CMD完成吗?

提前致谢。

2 个答案:

答案 0 :(得分:3)

使用纯批次可以这样做:

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

这意味着您不必安装任何其他程序或创建更多脚本。它可能不漂亮,但它的工作原理!我ping了61次,因为环回似乎会导致延迟秒。

答案 1 :(得分:1)

下载unixutils for win32。在这里,您会找到 sleep.exe 。把它放在你路上的某个地方。 (frex,在c:\ windows中)

然后,您可以构建类似于此

的批处理文件
echo off
:here    
sleep 60s
echo Exec app
rem your app goes here
goto here