Partilhar via


Msg

 

Applies To: Windows Vista, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows 8

Sends a message to a user on a Remote Desktop Session Host (RD Session Host) server.

For examples of how to use this command, see Examples.

Note

In Windows Server 2008 R2, Terminal Services was renamed Remote Desktop Services. To find out what's new in the latest version, see What’s New in Remote Desktop Services in Windows Server 2012 in the Windows Server TechNet Library.

Syntax

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

Parameters

Parameter

Description

<UserName>

Specifies the name of the user that you want to receive the message.

<SessionName>

Specifies the name of the session that you want to receive the message.

<SessionID>

Specifies 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 RD Session Host 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 that the message you sent is displayed on the user's screen. After 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 acknowledgment 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>

Specifies the text of the message that you want to send. If no message is specified, you will be prompted to enter a 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 user or a session, msg displays an error message. When specifying a session, it must be an active one.

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

Examples

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

    msg User1 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
    

Additional references

Command-Line Syntax Key

Remote Desktop Services (Terminal Services) Command Reference