我的是asp.net项目,xp系统,环境是vs2008文件
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
try
{
System.Diagnostics.Process p = new Process();
p.StartInfo.FileName = "cmd";
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;
p.Start();
string strOutput = null;
string s = @"C:\SWFTools\pdf2swf.exe " + Server.MapPath("~/Files/1.pdf") + " -o " + Server.MapPath("~/Files/1.swf");
p.StandardInput.WriteLine(s);
p.StandardInput.WriteLine("exit");
strOutput = p.StandardOutput.ReadToEnd();
Console.WriteLine(strOutput);
p.WaitForExit();
p.Close();
// lblMessage.Text = "success";
}
catch (Exception ex)
{
// lblMessage.Text = ex.ToString();
}
}
}