它只是说“'味精'不被识别为内部或外部程序...” 我已经搜索了很多,但还没有找到任何东西。为什么它不认识它?cmd命令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);
}
}
'msg'不是程序路径的一部分。 – Ofiris 2014-09-30 12:18:42
味精是一个可执行文件,为什么传递给cmd? – 2014-09-30 12:19:25
msg不算什么.. msg.exe或msg.bat可能是某种东西。 – TGlatzer 2014-09-30 12:20:47