0
我試圖運行在Visual Studio 2010中的C#應用程序avrdude
,並利用其輸出的RichTextox.
這裏是我的代碼: -如何在C#Windows窗體應用程序的Visual Studio運行AVRDUDE 2010
void proc_OutputDataReceived(object sender, DataReceivedEventArgs e)
{
if (e.Data != null)
{
string newLine = e.Data.Trim() + Environment.NewLine;
MethodInvoker append =() => txtOutput.Text += newLine;
txtOutput.BeginInvoke(append);
}
}
private void btnAVRDUSR_Click(object sender, EventArgs e)
{
string command = "/c avrdude";
ProcessStartInfo procStartInfo = new ProcessStartInfo("CMD", command);
Process proc = new Process();
proc.StartInfo = procStartInfo;
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
proc.Start();
procStartInfo.CreateNoWindow = true;
procStartInfo.WindowStyle = ProcessWindowStyle.Hidden;
procStartInfo.RedirectStandardOutput = true;
procStartInfo.UseShellExecute = false;
proc.OutputDataReceived += new DataReceivedEventHandler(proc_OutputDataReceived);
proc.Start();
proc.BeginOutputReadLine();
procStartInfo.CreateNoWindow = true;
procStartInfo.WindowStyle = ProcessWindowStyle.Hidden;
}
此,代碼不會在RichTextBox
中顯示任何內容。現在我決定使用pin命令。所以,我這個
string command = "/c ping 192.168.1.1";
這一次我的代碼炒鍋偉大替換該行
string command = "/c avrdude ";
。所以,任何人都可以告訴我爲什麼我的avrdude
不在這個代碼中工作。
avrdude不在當前目錄中,也不在搜索路徑中。 –
那麼,如何添加avrdude的路徑? –