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)