Delay in a 'for' loop in a batch file

Jack_111 picture Jack_111 · Jul 5, 2013 · Viewed 12.5k times · Source

I have this code, and I want to make a delay in the for loop to measure one time and then make a delay and continue after that.

I tried:

timout / t 10/ nobreak 

As it is shown in the code, but it didn't work.

: @echo off

set Looping_number=10 or anything else

FOR /L %%A IN (1,1,%Looping_number%) DO call :doit %%A
goto :eof

:doit
set pad=00%1
set num=%pad:~-2%
@set var1=var1.exe
@set var2=C:\...\...\... .txt
@set output=C:\....\output\%num% 
Mkdir %output%
%var1%     %var2%     %Results%  
timeout / t 10 / nobreak
goto :eof 

But it says you can not delay?

How can I fix this problem?

Answer

devnull picture devnull · Jul 5, 2013

You have extra spaces in your command:

timeout / t 10 / nobreak

You need to say:

timeout /t 10 /nobreak