C#调用WinRAR实现压缩与解压缩
2007-07-03 10:36
716 查看
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(" 有错完成"); }
}
}
.............
{ //************ 压 缩 *************
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(" 有错完成"); }
}
}
相关文章推荐
- C#调用WinRAR实现压缩与解压缩
- C#中使用WinRAR实现加密压缩及解压缩文件
- 利用C#调用WINRAR实现压缩与解压
- 利用C#调用WINRAR实现压缩与解压
- asp.net中调用winrar实现压缩解压缩的代码
- 利用C#调用WINRAR实现压缩与解压
- asp.net中调用winrar实现压缩解压缩的代码
- 利用C#调用WINRAR实现压缩与解压
- 利用C#调用WINRAR实现压缩与解压
- 利用C#调用WINRAR实现压缩与解压
- C#调用Winrar实现文件压缩
- C#调用Winrar实现解压缩
- 利用C#调用WINRAR实现压缩与解压
- asp.net中调用winrar实现压缩解压缩
- \t\t利用C#调用WINRAR实现压缩与解压
- c#调用 WinRAR.exe以命令行形式实现文件、文件夹的解压缩
- asp.net中调用winrar实现压缩解压缩
- 利用C#调用WINRAR实现压缩与解压
- asp.net中调用winrar实现压缩解压缩
- C# 利用ICSharpCode.SharpZipLib.dll 实现压缩和解压缩文件