简要咨询咨询QQ网站导航网站搜索手机站点联系我们设为首页加入收藏 

ASP.NET 运行.bat文件的实现方法

来源:易贤网   阅读:2719 次  日期:2014-08-22 14:38:29

温馨提示:易贤网小编为您整理了“ASP.NET 运行.bat文件的实现方法”,方便广大网友查阅!

// Create the ProcessInfo object

System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("cmd.exe");

psi.UseShellExecute = false;

psi.RedirectStandardOutput = true;

//psi.RedirectStandardInput = true;

psi.RedirectStandardError = true;

psi.Arguments = "/K C:\temp\test.bat";

psi.WorkingDirectory = "c:\temp\";

// Start the process

System.Diagnostics.Process proc = System.Diagnostics.Process.Start(psi);

// Attach the output for reading

System.IO.StreamReader sOut = proc.StandardOutput;

proc.Close();

// Read the sOut to a string.

string results = sOut.ReadToEnd().Trim();

sOut.Close();

// Write out the results.

string fmtStdOut = "{0}";

this.Response.Write(String.Format(fmtStdOut, results.Replace(System.Environment.NewLine, "

")));

更多信息请查看IT技术专栏

更多信息请查看网络编程
点此处就本文及相关问题在本站进行非正式的简要咨询(便捷快速)】     【点此处查询各地各类考试咨询QQ号码及交流群
上一篇:如何在ASP.NET程序中显示程序集版本号
下一篇:ASP.net 生成缩略图的实例源代码
易贤网手机网站地址:ASP.NET 运行.bat文件的实现方法
由于各方面情况的不断调整与变化,易贤网提供的所有考试信息和咨询回复仅供参考,敬请考生以权威部门公布的正式信息和咨询为准!