Msg Command (Examples, Switches, and More)

Msg command examples, options, switches, and more

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

When the 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.

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

Screenshot of the MSG help command in Windows 10

Msg Command Availability

The msg command is available from within the Command Prompt in Windows 11, Windows 10, Windows 8, Windows 7, Windows Vista, and Windows XP.

It's also available through the Command Prompt tool that's accessible in Advanced Startup Options and System Recovery Options.

The availability of certain msg command switches and other 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]

See How to Read Command Syntax if you're not sure how to interpret the msg command syntax as it's written above or described in the table below.

Msg Command Options
Option Explanation
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.

You can save the output of the command to a file using a redirection operator. See How to Redirect Command Output to a File for general instructions or check out our Command Prompt Tricks list for more tips.

Msg Command Examples

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

In this example, the msg command is being used to tell a select number of users contained in the myteam file [@filename] connected to the server that there should be a meeting at The Melting Pot for lunch [message].

msg RODREGT /server:TSWHS002 /time:300

Here, we've used the 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 we don't even want him to see it if he hasn't seen it after five minutes [/time:seconds].

Since a message wasn't specified, the msg command will present 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 a message for RODREGT, you'd press the Enter key, then CTRL+Z, then Enter again.

msg * /v Test Message!

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

This is an easy 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, you might have a difficult time getting it to work between two standard Windows machines like the net send command did. You might get an "Error 5 getting session names" or an "Error 1825 getting session names" message.

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 (reboot the computer after the change if you do this). 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 network-related commands, but generally, it'll be used alone to send a message.

Also, as mentioned a few times, this command is similar to the retired net send command.

Was this page helpful?