using System.Diagnostics;
.............
{ //************ 压 缩 *************
string strF="iis6.log";
string strR="newiis"; //压缩包文件名
Process p = new Process();
p.StartInfo.FileName="Winrar.exe";
p.StartInfo.CreateNoWindow=false;
// p.StartInfo.Arguments=" a -r "+strR+" "+strF; //默认压缩到RAR
// p.StartInfo.Arguments=" a -afzip "+strR+" "+strF; //压缩到Zip
// p.StartInfo.Arguments=" m "+strR+" "+strF; //压缩到RAR并删除原文件
// p.StartInfo.Arguments=" a -p123456 "+strR+" "+strF; //密码为123456
{ //************ 解 压 缩 *************
// p.StartInfo.Arguments=" x "+strR+" "+strF; //从RAR解压缩,文件名要一致
// p.StartInfo.Arguments=" x -p123456 "+strR+" "+strF; //解压加密的RAR
/* " x -o+" 覆盖已经存在的文件
" x -o-" 不覆盖已经存在的文件
" x " + strzipPath + " free1.txt "' + strtxtPath 只从压缩包中解压出free1.txt,其它文件不予解压
" -y" 对所有询问回应为"是",即发生错误也不弹出窗口
" -cl" 转换文件名为小写字母 */
p.Start();
if p.HasExited
{
int iExitCode = p.ExitCode;
if (iExitCode == 0)
{ MessageBox.Show( "正常完成"); }
else
{ MessageBox.Show(" 有错完成"); }
}
}