waitfor

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

Waitfor

Synchronizes multiple computers across a network by using signals.

Syntax

waitfor [/sComputer [/u[Domain**\]User[/p** [Password]]]] /siSignalName

waitfor [/tTimeoutInSeconds] SignalName

Parameters

  • /s Computer
    Specifies the name or IP address of a remote computer (do not use backslashes). The default is the local computer. This parameter applies to all files and folders specified in the command.
  • /u[ Domain\] User
    Runs the script with the permissions of the specified user account. The default is system permissions.
  • /p[ Password]
    Specifies the password of the user account that is specified in the /u parameter.
  • /t TimeoutInSeconds
    Specifies the number of seconds to wait. The default is indefinite.
  • /si
    Sends SignalName instead of waiting.
  • SignalName
    Specifies the signal for which waitfor waits or that it sends. SignalName is not case-sensitive.
  • /?
    Displays help at the command prompt.

Remarks

  • Only one instance of waitfor can wait for a given signal on a given computer.

  • Signal names are not case-sensitive.

  • Signal names cannot exceed 225 characters and cannot contain characters other than a-z, A-Z, 0-9, and ASCII characters in the range of 128-255.

  • If you do not use /s, the signal is broadcast to all computers within the same domain as the sending computer. If you use /s, the signal is sent only to the specified computer.

  • You can run multiple instances of waitfor on a single computer, but each must wait for a different signal. You can trigger a signal by using the /si command-line option.

  • Waitfor runs only on Windows XP and servers running a Windows Server 2003 operating system, but it can send signals to any computer running a Windows operating system.

  • Computers can only receive signals if they are in the same domain as the computer sending the signal.

  • You can use waitfor when you test software builds. For example, the compiling computer can send out a signal to several computers running waitfor after the compile has completed successfully. On receipt of the signal the batch file that includes waitfor can instruct the computers to immediately start installing software or running tests on the compiled build.

Examples

To wait 10 seconds or until the "espresso\compile007" signal is triggered, type:

waitfor /t 10 espresso\build007

To wait forever (the default) or until the "espresso\build007" signal is triggered, type:

waitfor espresso\build007

To trigger the "espresso\build007" signal, type:

waitfor /si espresso\build007

Formatting legend

Format Meaning

Italic

Information that the user must supply

Bold

Elements that the user must type exactly as shown

Ellipsis (...)

Parameter that can be repeated several times in a command line

Between brackets ([])

Optional items

Between braces ({}); choices separated by pipe (|). Example: {even|odd}

Set of choices from which the user must choose only one

Courier font

Code or program output

See Also

Concepts

Command-line reference A-Z
Command shell overview