Anyone familiar with the command-line tool MSG knows that the message it sends can only be displayed in a single line, if you want to display the message in multiple lines. After a few days of research, I developed an enhanced version of the message sending tool MSGX, which is still based on MSG, as long as the use of MSG can be used where the MSGX, the use of the same method is basically the same. The following is the source code of MSGX, if you have any questions welcome prawns.
:: Based on MSG. Exe
::D esigned by computer Studio of Zhou Zhou on 2016.7.7
@echo off
If "%1" = = "" Goto Help
If "%1" = = "/?" Goto Help
If "%2" = = "" Goto Help
echo.%2 | findstr/i/C: "/M:" >nul&& set msgx_n=2&& set msgx_a=%2&& goto RUN
echo.%3 | findstr/i/C: "/M:" >nul&& set msgx_n=3&& set msgx_a=%3&& goto RUN
echo.%4 | findstr/i/C: "/M:" >nul&& set msgx_n=4&& set msgx_a=%4&& goto RUN
echo.%5 | findstr/i/C: "/M:" >nul&& set msgx_n=5&& set msgx_a=%5&& goto RUN
echo.%6 | findstr/i/C: "/M:" >nul&& set msgx_n=6&& set msgx_a=%6&& goto RUN
msg%username%/w "MSGX error:/M parameter Missing! "&goto Help
: Help
Echo sends the message to the user.
Echo.
echo MSGX {username ^| sessionname ^| sessionid ^| @filename ^| *}
echo [/server:servername] [/time:seconds] [/v] [/w] [/m:message1]{\n}[message2] ...
Echo.
The echo username identifies the specified user name.
Echo sessionname session name.
Echo SessionID session ID.
The echo @filename identifies a file that contains the user to whom the message was sent
A list of echo names, conversation names, and session ID numbers.
echo * sends information to all sessions on the specified server.
Echo/server:servername the server to contact (the default value is the current value).
Echo/time:seconds wait for the receiver to acknowledge the time delay of the message.
ECHO/V displays information about the action performed.
ECHO/W waits for a user's response, which is useful with/V.
The message to be sent by the echo message. If not specified, a prompt is issued, or from stdin
Echo read.
echo \ n line break
Echo.
Echo is called with the call command in the batch and needs to be enabled for setlocal enabledelayedexpansion
Echo sends a message with a space that must be enclosed in double quotation marks "", such as MSGX */M: "Nice to meet you!"
Echo.
Pause
Goto EOF
: RUN
:: Setlocal enabledelayedexpansion
Echo. !msgx_a! |findstr/i/C: "Msgx_a" >nul&& msg%username%/w "MSGX error: setlocal enabledelayedexpansion not Enabled" & ;& Goto EOF
Set msgx_a=!msgx_a:/m:=!
The blank line below REM cannot be omitted
Set msgx_a=!msgx_a:\n=^
!
If "%msgx_n%" = = "2" msg%1!msgx_a!
If "%msgx_n%" = = "3" msg%1%2!msgx_a!
If "%msgx_n%" = = "4" msg%1%2%3!msgx_a!
If "%msgx_n%" = = "5" msg%1%2%3%4!msgx_a!
If "%msgx_n%" = = "6" msg%1%2%3%4%5!msgx_a!
Set msgx_a=
Set msgx_n=
: EOF
Click on the attachment below to download the "MSGX Message sending enhancement tool".
This article is from "Boat Computer Studio" blog, please be sure to keep this source http://conducer.blog.51cto.com/841262/1814366
MSGX Message Sending enhancement tool [DOWNLOAD]