我使用 this method given by boflynn 成功显示了批处理文件中的消息框对于上一个问题。
我试图在消息框正文中插入回车符,但迄今为止我的所有尝试以及引号和 Char(13) 的组合都失败了。
引用上面链接的答案,我正在寻找一个可以将文本放在多行上的消息框,例如:
This will be shown in a popup
这可能吗?
最佳答案
VBScript 有一个 builtin constant vbCr
表示回车符。将您的(子)字符串与该常量连接起来并显示带有结果的消息框:
MsgBox "This will" & vbCr & "be shown" & vbCr & "in a popup"
要显示批处理文件中的多行文本,您需要将每一行作为单独的参数传递
cscript MessageBox.vbs "This will" "be shown" "in a popup"
并连接参数
ReDim args(WScript.Arguments.Count-1)
For i = 0 To WScript.Arguments.Count-1
args(i) = WScript.Arguments(i)
Next
MsgBox Join(args, vbCr)
关于batch-file - 批处理文件消息框: Carriage return in message body,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38827874/