日期:2014-05-17 浏览次数:20713 次
string fppath = System.Configuration.ConfigurationManager.AppSettings["FlashPaperPath"];
fppath = Server.MapPath(fppath);
string param = fppath + " " + filepath + " -o " + Server.MapPath(outpath);
string sys = Environment.SystemDirectory;
p.StartInfo.FileName = Environment.SystemDirectory + "\\cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
try
{
p.Start();
string strOutput = null;
p.StandardInput.WriteLine(param);
p.StandardInput.WriteLine("exit");
strOutput = p.StandardOutput.ReadToEnd();
Console.WriteLine(strOutput);
Thread.Sleep(5000);//等待转化
p.WaitForExit();
p.Close();
}
catch (Exception ex)
{
return "转化异常:" + ex.ToString();
}