它只是說「'味精'不被識別爲內部或外部程序...」 我已經搜索了很多,但還沒有找到任何東西。爲什麼它不認識它?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