这是我的代码:
Process p = new Process();
try
{
string param = @"E:\FlashPaper\FlashPaper\FlashPaper2.2\FlashPrinter.exe D:\aa.doc -o D:\aa.swf";
p.StartInfo.FileName = "C:\\WINDOWS\\system32\\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);
p.WaitForExit();
p.Close();
}
catch (Exception ex)
{
throw ex;
} }
catch (Exception ex)
{
throw ex; }
如果param 是上面的那个,那么程序可以执行,但是当我把param 换成这个:
param = @"E:\SWF2005\SWF2005\WebApplication1\SWFTools\pdf2swf.exe D:\ppt.pdf -o D:\ppt.swf -T 9 –f";
程序就会不执行,这是为什么啊,不都一样吗?请高手帮忙。
Process p = new Process();
try
{
string param = @"E:\FlashPaper\FlashPaper\FlashPaper2.2\FlashPrinter.exe D:\aa.doc -o D:\aa.swf";
p.StartInfo.FileName = "C:\\WINDOWS\\system32\\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);
p.WaitForExit();
p.Close();
}
catch (Exception ex)
{
throw ex;
} }
catch (Exception ex)
{
throw ex; }
如果param 是上面的那个,那么程序可以执行,但是当我把param 换成这个:
param = @"E:\SWF2005\SWF2005\WebApplication1\SWFTools\pdf2swf.exe D:\ppt.pdf -o D:\ppt.swf -T 9 –f";
程序就会不执行,这是为什么啊,不都一样吗?请高手帮忙。
Process pc = new Process();
ProcessStartInfo psi = new ProcessStartInfo(“C:\\SWFTools\\pdf2swf.exe”, “Paper3.pdf Paper3.swf”);
pc.StartInfo = psi;
pc.Start();
pc.WaitForExit();
这是不是param = @"C:\\SWFTools\\pdf2swf.exe Paper3.pdf -o Paper3.swf";
的cmd命令吗?跟这个是好像有点不一样啊。
param = @"E:\SWF2005\SWF2005\WebApplication1\SWFTools\pdf2swf.exe D:\ppt.pdf -o D:\ppt.swf -T 9 –f";