它只是说“'msg'不被识别为内部或外部程序......” 我已经搜索了很多,但仍然没有找到任何东西。为什么它不认识它?
private void button1_Click(object sender, EventArgs e)
{
string strCmdText;
string user = textBox1.Text;
string host = textBox2.Text;
string time = textBox3.Text;
string text = textBox4.Text;
if (textBox1.Text == "")
{
System.Windows.Forms.MessageBox.Show("You haven't specified a user!");
}
else if(textBox2.Text == "")
{
System.Windows.Forms.MessageBox.Show("You haven't specified the host!");
}
else if (textBox3.Text == "")
{
System.Windows.Forms.MessageBox.Show("You haven't specified the shutdown timer");
}
else
{
strCmdText = "/c msg " + user + "/server:" + host + " /time:" + time + " /w " + text;
System.Diagnostics.Process.Start("CMD.exe", strCmdText);
}
}
最佳答案
我猜你有 64 位机器。因此,请尝试指定 msg.exe
C:\Windows\Sysnative\msg.exe
的完整路径或添加 C:\Windows\Sysnative
到路径变量。
关于c# - cmd命令消息不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26120533/