我想在C#Windows窗體應用程序(不是控制檯之一,帶有選項卡頁面,配置和控制檯作爲列表框)的某種應用程序。輸入進程(批處理文件)
我的問題是,當我寫某種輸入(文本框)時,沒有任何反應(我是編碼新手)。
我的代碼:
Process process = new Process
{
StartInfo =
{
FileName = textBox2.Text,
//Arguments = textBox3.Text,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardInput = true,
CreateNoWindow = false,
}
};
server = process;
process.Start();
...
/* LATER */
...
serverInput = process.StandardInput;
...
serverInput.Write(textBoxInput.Text);
更新 - 解決:代碼:
serverInput.WriteLine(...);
你開始哪個過程?在textBox2.Text中輸入什麼值? – Hassan
@HassanNisar你可以插入任何東西到textBox2.Text(現在),但你應該有批處理文件的目錄。 – Mibac