文件压缩

string winRAR = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + @"/WinRAR/WinRAR.exe";

StringBuilder command 
= new StringBuilder(" a -ep /"" + RARFile + "/" ");
for (int i = 0; i < Files.Count; i++)
{
   command.Append(
"/"" + Files[i] + "/" ");
}
ProcessStartInfo info 
= new ProcessStartInfo(winRAR, command.ToString());
Process process 
= new Process();
process.StartInfo 
= info;
process.Start();
process.WaitForExit();

 


当然,你还得先判断一下winrar.exe是否存在

你可能感兴趣的:(文件压缩)