Is there a WAIT command?

D

Dhruv

Hi,

In my batch file, I need the process should wait for 30
seconds continue executing subsequent lines. Is there a
SLEEP or WAIT commands availble? I know there are
sleep.exe and doze.exe freewares are available but is
there something I can do within the command process itself?
 
T

Torgeir Bakken \(MVP\)

Dhruv said:
In my batch file, I need the process should wait for 30
seconds continue executing subsequent lines. Is there a
SLEEP or WAIT commands availble? I know there are
sleep.exe and doze.exe freewares are available but is
there something I can do within the command process itself?
Hi

You can do a sleep using ping.exe (not CPU intensive).

Sleep approx. 5 seconds (number behind -n is seconds +1):

ping.exe -n 6 127.0.0.1 >nul
 
T

Tom Lavedas

I often wonder in cases like this if the op is really
locking for the /Wait switch of the START utility because
a piece of Win32 code is being executed (type START/? at a
command prompt). It makes a better solution than an open
ended 'sleep'.

Tom Lavedas
===========
 
G

guard

In my batch file, I need the process should wait for 30
seconds continue executing subsequent lines. Is there a
SLEEP or WAIT commands availble? I know there are
sleep.exe and doze.exe freewares are available but is
there something I can do within the command process itself?

The FREE Advanced NT/2K/XP/K3 Command Library
provides the ".Wait" command. For example,
to wait about 1 minute:

C:\GuardPost>%.Wait% 60

*******

Also, the Expert Command Library (NTCmdLib.cmd)
provides a $WAITFOR function:

*******

$WAITFOR WaitTime RefreshInterval "[Command/Program]"

Waits for the requested time, then executes [optional] Command.

NTCmdLib $WAITFOR 120 30 "dailybackup.cmd"

WaitTime = How long to wait (in minutes)
RefreshInterval = How often to update the console
status message (in minutes)

"Command/Program" = Optional Command/Program to execute
after waiting.

If no "Command" is specified, a default of "%.rem%" will be executed.

*******

C:\GuardPost>NTCmdLib /q $WAITFOR 5 1 "ECHO:We're movin' on!"

[Thu 02/27/2003 23:47:24] 5 minute(s) left...
[Thu 02/27/2003 23:48:24] 4 minute(s) left...
[Thu 02/27/2003 23:49:24] 3 minute(s) left...
[Thu 02/27/2003 23:50:24] 2 minute(s) left...
[Thu 02/27/2003 23:51:24] 1 minute(s) left...
[Thu 02/27/2003 23:52:24] WAITFOR Completed.
We're movin' on!

*******


Reference Pages:

Advanced Library

(http://ntlib.com)
(http://TheSystemGuard.com/MtCmds/CrystalClear/Wait.htm)
(http://TheSystemGuard.com/MtCmds/CrystalClear/Rem.htm)


Expert Library

(http://NTCmdLib.com)
(http://TheSystemGuard.com/NTCmdLib/Functions/WAITFOR.htm)

*******

Notes:

1. .Mount/\Commands are constructed using ONLY builtin
commands common to all four platforms (NT/2K/XP/K3).
2. .M/\C's are NOT case sensitive. Mixed case is used
for visual clarity only.
3. All of our Command Libraries require no resources
except what is already present in a standard install
of Windows NT/2K/XP/K3.

*******

-tsg

/-----------------+---------------+----------------------\
| COMPATIBILITY | CLARITY | SPEED |
| Write code ONCE | Make it clear | THEN...Make it fast! |
\-----------------+---------------+----------------------/
400+ command-line resources using ONLY native NT commands!
(http://TheSystemGuard.com/default.asp#MasterCommandList)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top