msg * 批量需要换行怎么办?
我正在运行以下代码片段,
Msg * "Hoi %username%, je kunt nu alle vensters sluiten en AutoCAD opniew opstarten"
但我想在 %username% 之后换一个新行,我该如何实现这一点?
编辑:
ECHO PROOF OF FILE EXECUTION: > "%username%'s proof of file execution.txt"
ECHO.
ECHO EXECUTED BY: %username% >> "%username%'s proof of file execution.txt"
ECHO ON: %date% >> "%username%'s proof of file execution.txt"
ECHO AT: %time% >> "%username%'s proof of file execution.txt"
ECHO .
ECHO PC DETAILS:
ECHO .
ECHO COMPUTER: %COMPUTERNAME% >> "%username%'s proof of file execution.txt"
Msg * "Hoi %username% je kunt nu alle vensters sluiten en AutoCAD opniew opstarten"
Im running the following code snipet
Msg * "Hoi %username%, je kunt nu alle vensters sluiten en AutoCAD opniew opstarten"
but i want a new line after %username% how can i achieve this?
EDDIT:
ECHO PROOF OF FILE EXECUTION: > "%username%'s proof of file execution.txt"
ECHO.
ECHO EXECUTED BY: %username% >> "%username%'s proof of file execution.txt"
ECHO ON: %date% >> "%username%'s proof of file execution.txt"
ECHO AT: %time% >> "%username%'s proof of file execution.txt"
ECHO .
ECHO PC DETAILS:
ECHO .
ECHO COMPUTER: %COMPUTERNAME% >> "%username%'s proof of file execution.txt"
Msg * "Hoi %username% je kunt nu alle vensters sluiten en AutoCAD opniew opstarten"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
输出:
带变量:
输出
Output:
With variable:
Output
问题是,“Msg”是什么,它是批处理还是exe文件?
它是否支持<换行>?
你可以试试这个,也许有效。
但如果有效,取决于消息命令
The question is, what is "Msg", is it a batch is it an exe file?
Does it support a < Linefeed >?
You can try this, perhaps it works.
But if it works, depends of the Msg-Command
这里提供的所有示例要么很复杂并且包含不必要的代码,要么运行时会出错。特别是当你想通过“Msg”打印许多其他“ANSI”字符时。
该代码已经过多种变体的测试。简单且工作稳定:
(echo %str1%&echo %str2%)|msg "%username%"
或*
示例:
Win+R > cmd /c "
@(echo 更多字符串&echo.&echo 给你!)|@msg *
"结果:
MsgBox
All examples presented here are either complex and contain unnecessary code, or they will work with errors. Especially when you want to print many other "ANSI" characters through "Msg".
The code has been tested in many variations. It is simple and works stably:
(echo %str1%&echo %str2%)|msg "%username%"
or*
Example:
Win+R > cmd /c "
@(echo More Strings&echo.&echo For You !)|@msg *
"Result:
MsgBox
杰布的回答对我不起作用。换行符使 msg 跳过其后面的所有文本
解决方案是创建一个模板 msg.txt 文件,其中包含换行符并将其通过管道传输到 msg 中:
Jeb's answer didn't work for me. The linefeed made msg skip all text following it
The solution is to create a template msg.txt file containing the newlines and piping that into msg: