它只是说“'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位计算机。因此,请尝试指定path变量的完整路径msg.exe
C:\Windows\Sysnative\msg.exe
或将其添加C:\Windows\Sysnative
到path变量。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句