Wait for or send a signal. Waitfor is used to synchronize events between one or more networked computers.
Syntax Wait for a signal:
waitfor [/t Timeout] SignalName Send a signal: waitfor [/s Computer [/u [Domain\]User [/p [Password]]]] /si SignalName Key /s Computer The name or IP address of the computer to signal (do not include backslashes). /u User Run the script using the credentials of the specified user account. By default, waitfor uses the current user's credentials. /p [Password] The password of the user account specified with /u /si Send the signal across the network to waiting machines. /t Timeout Number of seconds to wait for a signal. The valid range is 1 - 99999 (27.7 hours) default = wait indefinitely. SignalName The signal that waitfor waits for or sends. SignalName is not case-sensitive. /? Display help.
Signal names cannot exceed 225 characters. Valid characters include a-z, A-Z, 0-9, the SignalName is not case-sensitive.
If the command line includes /s Computer, the signal will be broadcast only to the specified system rather than all the computers across the domain. On large domains or wide area networks this will reduce unnecessary network traffic.
To cancel WAITFOR before its timeout has been reached, either launch Waitfor /si signal from a separate command-prompt or KILL the session.
You can run multiple instances of WAITFOR on a single computer, but each instance must wait for a different signal. Only one instance of WAITFOR can wait for a given signal on a given computer. Computers can only receive signals if they are in the same domain as the computer sending the signal.
Batch scripts including WAITFOR can be run as Scheduled tasks under the SYSTEM account.
Typical WAITFOR applications include waiting for large ROBOCOPY jobs to complete, restarting services across a cluster/farm, FTP or BITS downloads, compiling software builds etc.
Wait for 60 seconds or until the "simon" signal is received on the local computer:
C:\> waitfor /t 60 simon
Activate the "simon" signal on the local computer:
C:\> waitfor /s %computername% /si simon
Wait for 1 hour or until the "backupComplete" signal is received on the local computer:
C:\> waitfor /t 3600 BackupComplete
Activate the "backupComplete" signal on the computer Server64:
C:\> waitfor /s Server64 /si backupComplete
“Non-violence is not inaction. It is not discussion. It is not for the timid or weak... Non-violence is hard work. It is the willingness to sacrifice. It is the patience to win” ~ Cesar Chavez
PAUSE - Suspend processing of a batch file and display a message.
SLEEP - Delay execution for a few seconds/minutes (for use within a batch file).
TIMEOUT - Delay execution for a few seconds/minutes (for use within a batch file).
Powershell: Start-Sleep - Suspend shell, script, or runspace activity (sleep).
Bash: wait - Wait for a process to complete.