用winrar解压缩文件(二)

 用winrar压缩文件(一) 里面说了压缩,现在说解压

   string strDirPath =  ConfigurationSettings.AppSettings["ftpPath"];
   string[] strftpfile =  ConfigurationSettings.AppSettings["ftpFile"].ToString().Trim().Split(',');

   try
   {
    for (int i=0;i    {

     System.Diagnostics.Process Process1=new System.Diagnostics.Process();
     Process1.StartInfo.FileName=@"rar.exe";
     Process1.StartInfo.Arguments=@"x -inul -y -o+ "+ strDirPath + @"\" + strftpfile[i] + "  " + strDirPath;
     Process1.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
     Process1.Start();    //进行解压
   
     while(!Process1.HasExited)          //等待压缩的完成
     {
                    
     }

     Process1.WaitForExit();
     if(Process1.ExitCode != 0)
     {
      //MessageBox.Show("解压文件时出错!",Process1.ExitCode.ToString());


     }
    }
      //MessageBox.Show("解压文件完成!",Process1.ExitCode.ToString());   
   }
   catch(Exception ex)
   {
  
      //MessageBox.Show("解压文件时出错!",Process1.ExitCode.ToString());
   }

posted on 2007-05-22 10:20  RIVERSPIRIT  阅读(162)  评论(0)    收藏  举报