c#用rar压缩文件

            string startpath = "E:\\send\\one\\234";
            string endpath = "E:\\savefile\\456.rar";
            System.Diagnostics.Process pro = new System.Diagnostics.Process();
            pro.StartInfo.FileName = System.Environment.CurrentDirectory + "\\WinRAR.exe";//WinRAR.exe的路径,放在exe同目录下
            pro.StartInfo.Arguments = string.Format("a -en  -ep1 {0} {1}", endpath, startpath);//压缩保存文件,需要压缩的文件
            pro.Start();
            pro.WaitForExit();无期限等待进程退出
            pro.Close();
            pro.Dispose();



你可能感兴趣的:(c#用rar压缩文件)