C# 执行bat批处理文件

C# 执行bat批处理文件
 
 1 ///batPath为.bat 可执行文件的绝对路径
 2 private void RunBat(string batPath)
 3 {
 4 Process pro = new Process(); 
 5 FileInfo file = new FileInfo(batPath);
 6 pro.StartInfo.WorkingDirectory = file.Directory.FullName;
 7 pro.StartInfo.FileName = batPath;
 8 pro.StartInfo.CreateNoWindow = True;//隐藏窗体的显示
 9 pro.Start();
10 pro.WaitForExit();
11 }

 

posted @ 2013-10-18 16:28  帅刺猬之家  阅读(551)  评论(2编辑  收藏  举报