pausing a *.bat

hi guys,

i want to have a batch file *.bat that runs a command then pauses for a few seconds then runs a second command.

i know theres the “pause” command, but that waits for user interaction,

so is there a command i can use?

were talking windows dos here btw, sorryt linuxy people

thanks

another one that got forgot off the DOS commands. You have to cheat horridly.

from the batch file you want to wait, call another batch file wait.bat

wait.bat contains
@ping 127.0.0.1 -n 2 -w 1000 > nul
@ping 127.0.0.1 -n %1% -w 1000> nul

or some other time consuming routine, not great I know but from memory the only way it could be done using pure batch. The other way of course is to shell execute your first batch file in a little vb app, then run a timer to ‘wait’ and then run the second half of your batch file. Nicer for an end user, but a little harder to do.

DT.

you HACK! :smiley:

love it! :haha:

brill thanks mate :slight_smile: trust m$ to forget something as usefull as a pause… :sigh:

Best way is to copy a file and then delete it…make it’s size …to about X-per second in size…
Faster bus bigger file…works well…

You could also get the sleep.exe executable from the NT resource kit (not sure if it is still available in 2000/XP etc) then use the sleep command in the batch file.

You simply add a line along the lines of

c: ools\sleep.exe 2h10m

(not sure of the exact format, used to use it on a patch disk to add machines to the domain)

is it necessary to use a .bat, try VB script(.vbs), it’s alot more powerfull and iirc anything from 2K onwards will run it, if you can write batch files you can write VBS files, trust me it’s how I got started.

I have a whole host of little scrips here you can rip apart if you want to learn the way I did.

Seriously, people ever tried the help command?

Notice how conviently on the list there is a command called wait.

Here is an example

start /wait

or

call /wait

My way = e.g. 5sec delay

ping -n 5 localhost > nul

you can use the /wait parameter but i’d still stick a ping delay anyway which kind of
nulls the need for using the /wait.

i looked at the help command at the time and couldnt see a wait command, trying help in my cmd prompt i still cant see a wait command :confused: am i missing something?

no its an addition parameter you tag to a call to a program

i.e. start notepad.exe /wait

and its waits for that to terminate before jumping to the next stage in your batch file.

If you want a batchfile to wait at a stage your not calling anything then
ping is still best.