您的位置:首页 > 其它

调用控制台程序函数 RunProcess

2006-08-30 16:45 232 查看
函数定义
private void RunProcess(String executable, String args,Boolean output)
{
#region
String line = String.Empty;
proc=new Process();
try
{
proc.StartInfo.FileName = executable;
proc.StartInfo.Arguments = args;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = output;
proc.StartInfo.RedirectStandardError = output;
proc.StartInfo.CreateNoWindow = false;
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
proc.Start();
proc.WaitForExit();
}

catch(Exception ex)
{
ex.ToString();
}
finally
{
proc = null;
}
#endregion
}
说明:
executable:控制台程序的exe文件所在路径和xxx.exe
args:运行参数
output:true
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: