View Full Version : .bat + wait
Hey, does anyone know how to get a batch file to wait before executing the next command?
I've tried:
"/wait"
"@ping 127.0.0.1 -n 2 -w 1000 > nul
@ping 127.0.0.1 -n %1% -w 1000> nul"
Neither of which took long enough...I need at least, a 299 second wait...
Anyone?
@ping 127.0.0.1 -n 299 -w 1000 > nul
So if one batch file is running a process and i tell that batch file to refer to another called "wait.bat" with that as it's command, once that is finished, the next command from the first batch file will execute?
[Edit] I didn't think "@ping 127.0.0.1 -n 2 -w 1000 > nul" that two was the second, i thought it was the amount of times it executes it... :rolleyes:
Yeah man, apparently pause isn't a command in command prompt in 2000/xp, so i've read, and it did nothing when i tried it...
As you can tell, this is the first batch file i've tried to make, i'm teaching myself...This is the only thing that is holding me up, i know it's easy as, but yeah, just trying it out...
Just wrote this, it works for me in WinXP. Give it a go and lemme know if it what you are after.
Create two batch files as listed below.
To make the bat file pause for 299 seconds at any time, just put - 'CALL wait.bat' as the command.
**************
process.bat
**************
REM - Calls 'wait.bat' and runs the commands in it.
REM - Returns and continues torun 'process.bat'
REM- once 'wait.bat' is complete.
CALL wait.bat
**************
**************
wait.bat
**************
REM - This causes a 299 second pause in 'wait.bat'. 'process.bat' will continue on once this
REM - pause is completed.
ping 127.0.0.1 -n 299 -w 1000 > nul
******************************
That works, thanks man...
But is there any way to get that ping process to run in the background, and not see the command prompt appear?
Add -
ECHO OFF
To the beginning of .bat files you wish to NOT display the commands of.
SilverShaft
15-06-2006, 11:08 AM
Pause has worked fine for me in XP and 2003
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.