【发布时间】:2017-03-03 01:02:42
【问题描述】:
有没有办法使用 C# 显示窗口弹出消息?
我的意思是使用windows的msg.exe程序可以在cmd中使用,例如:“msg * Hello”
PD:我知道我可以使用 MessageBox.Show() 代替。但我想知道这是否可能:(
我写了 2 种方法来做到这一点,但都没有奏效:
Process.Start("cmd.exe","/C msg * Hello");
还有……
Process cmd = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = "cmd.exe",
Arguments = "/C msg * Hello",
UseShellExecute = false,
RedirectStandardInput = true,
RedirectStandardOutput = true,
RedirectStandardError = true,
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden
}
};
cmd.Start();
【问题讨论】:
-
你为什么不把 msg.exe 作为文件名并把 *Hello 放在你的参数中?将 WindowStyle 更改为不隐藏。
-
好吧,因为这给了我一个错误:(
-
你遇到了什么错误?
标签: c# windows cmd process popup