msg.exe 打印“无效参数”

问题描述 投票:0回答:1

我正在开发一个小型服务器监控脚本,并且希望在检测到服务关闭后向用户显示一个弹出窗口,其中包含服务列表。我尝试使用

C:\Windows\SysWOW64\msg.exe
发送此消息,但它只是在 PowerShell 终端中给了我一条神秘的错误消息(“无效参数”,我以为我可能有特殊字符或错误的数据类型,但事实并非如此) :

PS U:\> msg * ("A" * 256)
Invalid parameter(s)
Send a message to a user.

MSG {username | sessionname | sessionid | @filename | *}
    [/SERVER:servername] [/TIME:seconds] [/V] [/W] [message]
windows powershell messagebox
1个回答
1
投票

msg.exe
显然只支持消息<= 255 characters in length. Use
Popup

(New-Object -ComObject "Wscript.Shell").Popup("Popup Message", 0, "Popup Title", 0+48)
© www.soinside.com 2019 - 2024. All rights reserved.