Msg

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

Msg

Sends a message to a user.

Syntax

Msg{UserName | SessionName | SessionID | @FileName | *} [/server:ServerName] [/time:Seconds] [/v] [/w] [Message]

Parameters
  • UserName
    The name of the user you want to receive the message.
  • SessionName
    The name of the session you want to receive the message.
  • SessionID
    The numeric ID of the session whose user you want to receive a message.
  • @ FileName
    Identifies a file containing a list of user names, session names, and session IDs that you want to receive the message.
  • *
    Sends the message to all user names on the system.
  • /server: ServerName
    Specifies the terminal server whose session or user you want to receive the message. If unspecified, /server uses the server to which you are currently logged on.
  • /time: Seconds
    Specifies the amount of time the message you sent is displayed on the user's screen. Once the time limit is reached, the message disappears. If no time limit is set, the message remains on the user's screen until the user sees the message and clicks OK.
  • /v
    Displays information about the actions being performed.
  • /w
    Waits for an acknowledgement from the user that the message has been received. Use this parameter with **/time:**Seconds to avoid a possible long delay if the user does not immediately respond. Using this parameter with /v is also helpful.
  • Message
    The text of the message you want to send. If no message is typed, you are prompted for it or standard input (that is, stdin) is read for the message. To send a message that is contained in a file, type the less than (<) symbol followed by the file name.
  • /?
    Displays help at the command prompt.
Remarks
  • If you do not specify a name for the user or session, msg displays an error message. When specifying the name of a session, it must be an active one.

  • The user must have send message access permission to send a message.

Examples

To send the message entitled "Let's meet at 1PM today" to all sessions for user MIKES, type:

msg MIKES Let's meet at 1PM today

To send the same message to session MODEM02, type:

msg modem02 Let's meet at 1PM today

To send the message to session 12, type:

msg 12 Let's meet at 1PM today

To send the message to all sessions contained in the file USERLIST, type:

msg @userlist Let's meet at 1PM today

To send the message to all users who are logged on, type:

msg * Let's meet at 1PM today

To send the message to all users, with an acknowledgment time-out (for example, 10 seconds), type:

msg * /TIME:10 Let's meet at 1PM today

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
Terminal Services commands