Log in

View Full Version : CMD ''Wait'' command?!?!



NiiX
11-10-2009, 06:13 PM
I'm trying to make a batch script that will wait for X secs and then do another thing.

Here is the script I'm using.


@echo off
set max=.ooooooooooooooooooooooooooooooooooooooooooooo ooooooo
set count=.
:LOOP
PING 1.1.1.1 -n 1 -w 60000 >NUL
echo hello there
set count=%count%o
if not %count%==%max% goto LOOP
set max=
set count=
Pause

This is what I've found on the net ''PING 1.1.1.1 -n 1 -w 60000 >NUL'' but it won't work, I've tried with upto 1 min (60000) and it still won't actually wait, it just loops without waiting.

I've googled here and there but yet no REAL wait that works.

rogeruk
11-10-2009, 11:53 PM
PING 1.1.1.1 -n 1 -w 5000 >NUL

works for me

Rick
11-11-2009, 12:09 AM
You could try:


PING 1.1.1.1 -n 1 -w 60000 >NUL
or
PING -n 61 127.0.0.1>nul


You could also use Sleep.exe [Microsoft] (http://www.microsoft.com/downloads/details.aspx?FamilyID=9D467A69-57FF-4AE7-96EE-B18C4790CFFD&displaylang=en) and use the command: SLEEP 3600

Wizzup?
11-11-2009, 12:39 AM
Just use "sleep".

NiiX
11-11-2009, 04:25 PM
Ty Richie and Wizzup!

For anyone with this problem in the future download this program (http://www.microsoft.com/downloads/details.aspx?FamilyID=9d467a69-57ff-4ae7-96ee-b18c4790cffd&DisplayLang=en) and then ''Sleep X'' will work like it is supposed to.

code841
11-11-2009, 09:05 PM
Yes but if you were planning to have the script run on other computers, they'd need to install that on as well which is to me a big hassle.

NiiX
11-12-2009, 07:08 PM
Yes but if you were planning to have the script run on other computers, they'd need to install that on as well which is to me a big hassle.

This script will be used locally to test something, I have full control over the PC's.