Msg Command

Msg Command Examples, Options, Switches, and More

Screenshot of the MSG help command in Windows 10
Msg Command (Windows 10).

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.

When the msg command is triggered, a prompt is displayed on the machine(s) that it was sent to that shows the message as well as the sender's username and the time that the message was sent.

Msg Command Availability

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

The msg command is also available through the Command Prompt tool that's accessible in Advanced Startup Options and System Recovery Options.

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

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.

usernameUse this option to specify a username to send the message to.
sessionnameSpecify 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.
@filenameUse 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:servernameThe servername is the server on which the usernamesessionname, 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:secondsSpecifying 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.
/vThe /v switch enables the command's verbose mode, which will display detailed information about the actions the msg command is taking.
/wThis 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.
messageThis 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". 

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

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 changing the AllowRemoteRPC registry value data from 0 to 1 on the computer receiving the message. This key is located in the Windows Registry under the HKEY_LOCAL_MACHINE hive at this location: SYSTEM\CurrentControlSet\Control\Terminal Server.

Msg Related Commands

The msg command 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 mentioned a few times, the msg command is similar to the retired net send command.

Was this page helpful?