1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Msg

By

What is the Msg Command?

The msg command is a Command Prompt command that's used to send a message to one or more users on the network.

The msg command functions similarly to the net send command that was popular in Windows XP but it is not a true replacement for it. See Using the Msg Command to Replace Net Send further down the page.

Msg Command Syntax

msg {username | sessionname | sessionid | @filename | *} [/server:servername] [/time:seconds] [/v] [/w] [message]

Tip: See How To Read Command Syntax if you're not sure how to interpret the msg command syntax above.

username = Use this option to specify a username to send the message to.

sessionname = Specify sessionname to send a message to a specific session.

sessionid = The sessionid option can be used to send a message to a session using the session's ID.

@filename = Use the @filename option to send a message to the user names, session names, and session ID's listed in the specified file.

* = The * option is used to send a message to every session on the servername.

/server:servername = The servername is the server on which the username, sessionname, or sessionid, resides on. If no servername is specified, the message will be sent as directed to the server you're executing the msg command from.

/time:seconds = Specifying a time in seconds with the /time switch gives the msg command a length of time to wait for the receiver of the message to confirm receipt of it. If the receiver does not confirm the message in seconds number of seconds, the message will be recalled.

/v = The /v switch enables the command's verbose mode, which will display detailed information about the actions the msg command is taking.

/w = This option forces the msg command to wait for a return message after you send a message. The /w switch is really only useful with the /v switch.

message = This is the message you want to send. If you don't specify a message then you'll be prompted to enter one after executing the msg command.

/? = Use the help switch with the msg command to show information about the command's several options.

Tip: You can save the output of the msg command to a file using a redirection operator with the command. See How To Redirect Command Output to a File for instructions or check out Command Prompt Tricks for more tips.

Msg Command Examples

msg @myteam The Melting Pot at 1pm, on me!

In this example, I used the msg command to tell a select number of users contained in the myteam file [@filename] connected to my server that we should meet at The Melting Pot for lunch [message].

msg RODREGT /server:TSWHS002 /time:300

Here, I've used the msg command to send a message to RODREGT [username], an employee that connects to the TSWHS002 [/server:servername] server. The message is very time sensitive, so I don't even want him to see it if he hasn't seen it after five minutes [/time:seconds].

Since I did not specify a message, the msg command will present me with a note at the prompt that says "Enter message to send; end message by pressing CTRL-Z on a new line, then ENTER". I enter a message

After entering my message for RODREGT, I press the Enter key, then CTRL-Z, then the Enter key again.

msg * /v Test Message!

In the above example, I'm sending everyone connected to my server a test message [message]. I also want to see the specific tasks that the msg command is performing to do this [/v].

This is an easy msg command example you can try at home, with no users connected to your computer. You'll see the message pop up on your own screen and the following data in the Command Prompt window, thanks to using the verbose switch:

Sending message to session Console, display time 60
Async message sent to session Console

Msg Command Availability

The msg command is available from within the Command Prompt in recent Windows operating systems versions including Windows 8, Windows 7, Windows Vista, and Windows XP.

Note: The availability of certain msg command switches and other msg command syntax may differ from operating system to operating system.

Using the Msg Command to Replace Net Send

The msg command is intended to be used as a messaging system to terminal server users, not necessarily between two Windows 7 computers, for example.

In fact, I've had a very difficult time getting the msg command to work between two standard Windows machines like the net send command did. I usually get an "Error 5 getting session names" or an "Error 1825 getting session names" error.

However, some have had luck using the msg command in this way by change the AllowRemoteRPC registry value data from 0 to 1 on the computer receiving the message. This key is located in the Windows Registry at this location: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server.

Msg Related Commands

The msg is a networking command so it might be used with other networking commands but generally it'll be used alone to send a message.

Also, as I've mentioned a few times, the msg command is similar to the retired net send command.

©2014 About.com. All rights reserved.