SoFunction
Updated on 2025-03-10

Bat code for pop-up message (more explanation of msg command)

Copy the codeThe code is as follows:

msg * "ok"


The command is to send a message to the user.

MSG {username | sessionname | sessionid | @filename | *}
[/SERVER:servername] [/TIME:seconds] [/V] [/W] [message]

username Identifies the specified username.
sessionname session name.
sessionid session ID.
@filename Identifies such a file that contains the message sent
A list of username, session name, and session identification number sent to.
* Send information to all sessions on the specified server.
/SERVER:servername The server to contact (the default value is the current value).
/TIME:seconds Time delay waiting for the receiver acknowledgement message.
/V Displays information about the actions performed.
/W Wait for the user's response, and it is useful with /V.
message The message to send. If not specified, issue a prompt.
Or read from stdin.



Microsoft's explanation:
The Terminal Server Session ID 0 tool does not handle

Note: This article is translated by an automatic machine translation system without manual intervention. These articles are provided by Microsoft for users who do not understand English to enable them to understand the content of these articles. Microsoft does not guarantee the accuracy of machine translation, nor is it responsible for any direct or indirect possible problems arising from mistranslation of the content or the customer's use of it.
Article number: 302799
Last modified: August 6, 2002
Revision: 1.0
symptom
For list users and you want to use the command line tool to send messages to users, a message may be sent to the console session when the session is in a list file, and a session ID of zero (0) may be received. If it is sent to the user who is logged in to the console, however, the message may arrive at the console.

reason
This behavior occurs because the process requires administrator privileges to send mass to the console.

state
This behavior is by design.

More information
List files with the description in the "Symptoms" section of this article can be user and session text files with lists (Admin, 0, user 1, 2, user15, 4, etc.). The file is then called when used, where the file name is the name made by the text file. For more information about the tool, used in Windows XP Help MSG search.