</pre><pre name="code" class="csharp">
</pre><pre name="code" class="csharp">
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();
}
转载自[ http://www.cnblogs.com/zjfree/ ],亲测可用,感谢分享
本文提供了一个使用C#来执行BAT批处理文件的示例代码,通过创建Process实例并设置StartInfo属性来实现。该方法适用于需要在Windows环境下执行特定命令的应用场景。
4893

被折叠的 条评论
为什么被折叠?



