protected void Page_Load(object sender, EventArgs e)
    {
         comm cm = new comm();
        //Response.Write(cm.RumCmd("ping www.baidu.com"));//可成功
        cm.RunProgram("C:\\Program Files\\SWFTools\\pdf2swf.exe", "test.pdf test1.swf");
    }
 public  class comm 
    {
       private Process p = null;
       public comm()
       {
           p = new Process();
       }
       /// <summary>
       /// 执行cmd命令
       /// </summary>
       /// <param name="cmd">需要执行的命令</param>
       /// <returns></returns>
       public string  RumCmd(string cmd)
       {
           string str = null;
           p.StartInfo.CreateNoWindow =true;
           p.StartInfo.FileName = "cmd.exe";
           p.StartInfo.UseShellExecute = false;
           p.StartInfo.RedirectStandardError = true; 
           p.StartInfo.RedirectStandardInput = true;
           p.StartInfo.RedirectStandardOutput = true; 
           p.Start();
           p.StandardInput.WriteLine(cmd);
           p.StandardInput.WriteLine("exit");
           p.WaitForExit();
           str = p.StandardOutput.ReadToEnd();
           p.Close();
           return str;
       }
       /// <summary>
       /// 通过CMD打开软件并执行相应命令
       /// </summary>
       /// <param name="programName"> 软件URL(.exe文件)</param>
       /// <param name="cmd">需要进行的操作</param>
       public void RunProgram(string programName,string cmd)  
       {   
           Process proc = new Process();   
           proc.StartInfo.CreateNoWindow = true;
//p.StartInfo.WorkingDirectory = "c:\\Documents and Settings\\Administrator\\";
           //p.StartInfo.Arguments
           proc.StartInfo.FileName = programName;
           proc.StartInfo.Arguments = cmd;
           proc.StartInfo.UseShellExecute = false; 
           proc.StartInfo.RedirectStandardError = true;  
           proc.StartInfo.RedirectStandardInput = true;  
           proc.StartInfo.RedirectStandardOutput = true;
           try
           {
               proc.Start();
               if (cmd.Length != 0)
               {
                   proc.StandardInput.WriteLine(cmd);
               }
               proc.Close();  
           }
           catch (Exception  )
           {
               throw;
           }
        
       }
    }   
    }