C#执行batwindows批处理

来源:互联网 发布:mac mail 设置模板 编辑:程序博客网 时间:2024/05/29 06:42

刚开始在网上找了很久,搜到了这个 

 private void RunBat(string batPath)
        {
            Process pro = new Process();
            FileInfo file = new FileInfo(batPath);
            pro.StartInfo.WorkingDirectory = file.Directory.FullName;
            pro.StartInfo.FileName = batPath;
            pro.StartInfo.CreateNoWindow = false;
            pro.Start();
            pro.WaitForExit();
        }

其实直接这样就行了

  Process.Start(strname);

0 0