msg * 批量需要换行怎么办?

发布于 2024-10-04 23:22:33 字数 766 浏览 9 评论 0原文

我正在运行以下代码片段,

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

你又不是我 2024-10-11 23:22:33
@echo off
msg * Hello^

World!^

Bye^

at^

all!

输出:

Hello
World!
Bye
at
all!

带变量:

@echo off
(set msg1=Hello^^^

^

)
msg * %msg1%World!

输出

Hello
World!
@echo off
msg * Hello^

World!^

Bye^

at^

all!

Output:

Hello
World!
Bye
at
all!

With variable:

@echo off
(set msg1=Hello^^^

^

)
msg * %msg1%World!

Output

Hello
World!
屋顶上的小猫咪 2024-10-11 23:22:33

问题是,“Msg”是什么,它是批处理还是exe文件?
它是否支持<换行>?

你可以试试这个,也许有效。

setlocal EnableDelayedExpansion
set lf=^


rem Two blank lines (without spaces are neccessary)
Msg * "Hoi %username%!lf! je kunt nu alle vensters sluiten en AutoCAD opniew opstarten" 

但如果有效,取决于消息命令

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.

setlocal EnableDelayedExpansion
set lf=^


rem Two blank lines (without spaces are neccessary)
Msg * "Hoi %username%!lf! je kunt nu alle vensters sluiten en AutoCAD opniew opstarten" 

But if it works, depends of the Msg-Command

孤独陪着我 2024-10-11 23:22:33

这里提供的所有示例要么很复杂并且包含不必要的代码,要么运行时会出错。特别是当你想通过“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

拥抱影子 2024-10-11 23:22:33

杰布的回答对我不起作用。换行符使 msg 跳过其后面的所有文本

解决方案是创建一个模板 msg.txt 文件,其中包含换行符并将其通过管道传输到 msg 中:

echo Hoi %username% >msg.txt
echo. >>msg.txt
echo je kunt nu alle vensters sluiten en AutoCAD opniew opstarten >>msg.txt

type 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:

echo Hoi %username% >msg.txt
echo. >>msg.txt
echo je kunt nu alle vensters sluiten en AutoCAD opniew opstarten >>msg.txt

type msg.txt |msg *
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文