C# Windows Forms bat (Batch file) 批次檔
//button按鍵
private void button1_Click(object sender, EventArgs e)
{
//參數設定,參數前後加上雙影號,避免資料空格會使bat接收資料錯誤
string Data0 = "\"" + @"Deat0" + "\"";
string Data1 = "\"" + @"D:\Test\Deat1" + "\"";
//執行bat
ProcessStartInfo Info = new ProcessStartInfo()
{
FileName = @"test2020.bat", //執行的檔案名稱
WorkingDirectory = @"c:\aaa\bbb\ccc", //檔案所在的目錄
Arguments = String.Format("{0} {1}", Data0, Data1), //輸入參數
};
Process.Start(Info);
//關閉程式
this.Close();
}
我只是一棵樹