1.

Solve : delay in batch script?

Answer»

Hi,

How to SET delay in batch script. I would like my batch script to wait for 15 seconds. Please advice.

Thanks.!!Method (1) USES vbscript sleep method

Code: [Select]REM Delay in seconds
set delay=15
set /a ds=%delay%*1000
ECHO wscript.sleep(%ds%)>wait.vbs
echo %time%
cscript //nologo wait.vbs
echo %time%
del wait.vbs

Method (2) a fixed delay can also be produced by the PING command with a loopback address:

Code: [Select]REM Delay in seconds
set delay=15
set /a pd=%delay%+1
PING -n %pd% 127.0.0.1>nul Shouldn't this line

Code: [Select]cscript //nologo wait.vbs
be like this

Code: [Select]start /wait cscript //nologo wait.vbsThank you for your reply.  Have a good one..!! Quote from: Linux711 on September 15, 2010, 07:33:21 AM

Shouldn't this line

Code: [Select]cscript //nologo wait.vbs
be like this

Code: [Select]start /wait cscript //nologo wait.vbs

No. (Have you tried it?) If start /wait was required I would have included it. 

Used as I showed, cscript returns control (either to a calling script or the command PROMPT) when the vbscript exits, not before.





WRONG thread, wrong reply, sorry


Discussion

No Comment Found