Using System.Diagnostics;
.............
{//************ compression *************
String strf= "Iis6.log";
String strr= "Newiis"; Compress package file name
Process P = new process ();
P.startinfo.filename= "Winrar.exe";
P.startinfo.createnowindow=false;
p.startinfo.arguments= "A-r" "+strr+" "+STRF; Default compression to RAR
p.startinfo.arguments= "A-afzip" "+strr+" "+STRF; Compress to zip
P.startinfo.arguments= "M" +strr+ "" +STRF; Compress to RAR and delete original file
p.startinfo.arguments= "a-p123456" "+strr+" "+STRF; Password is 123456
{ //************ extract *************
// p.startinfo.arguments= "x" +strr+ "" +strf; //from RAR uncompressed, file name to be consistent
// p. startinfo.arguments= "x-p123456" +strr+ "" +strf; //Unzip the encrypted RAR
/* "x-o+" overwrites existing files
"x-o-" does not overwrite existing files
"x" + Strzippath + " free1.txt" ' + strtxtpath extract fr only from compressed package Ee1.txt, other files are not uncompressed
"-y" response to all inquiries is "yes", that is, errors do not pop-up windows
"-CL" Convert file name is lowercase * */
p.start ();
if p.hasexited
{
int iExitCode = P.ExitCode;
if (iexitcode = 0)
{ MessageBox.Show ("normal completion"); }
else
{ messagebox.show ("error Complete"); }