zoukankan      html  css  js  c++  java
  • cmd实现cab文件的压缩与解压

    压缩(makecab):

    1.单文件压缩

    makecab ip2.txt ip2.txt.cab

    2.多文件压缩

    makecab /f c:list.txt /d expresstype=mszip /d expressmemory=21 /d maxdisksize=1024000000 /d diskdirectorytemplate=C:cab /d cabinetnametemplate=test.cab

    其中:

    /f 指定的c;list.txt(路径自定义)是你要进行压缩的文件的列表,不能包含文件夹,在根文件下的子文件夹中不能包含相同文件名的文件,因为cab压缩后不保留文件结构,就是类似于将多个文件压缩到一个文件夹下,否则会报错(ERROR: Duplicate file name)。

      list.txt 可以使用: 

    for /r %i in (你的目录*.*) do echo %i >>c:list.txt

    /d 指定变量

    expresstype=mszip  //压缩类型:MSZIP,LZX
    expressmemory=21 //压缩占用内存
    maxdisksize=1024000000  //生成的cab文件最大占用的磁盘容量
    diskdirectorytemplate=C:cab  //生成的cab文件的路径
    cabinetnametemplate=test.cab  //cab文件名
    UniqueFiles="OFF" //没用过
    Cabinet=on   //没用过

    结果:

    Cabinet Maker - Lossless Data Compression Tool
    
    2,103,331 bytes in 27 files
    Total files:             27
    Bytes before:     2,103,331
    Bytes after:      1,017,699
    After/Before:            48.39% compression
    Time:                     1.56 seconds ( 0 hr  0 min  1.56 sec)
    Throughput:            1315.00 Kb/second
    expand -d c:cab	est.cab
    Microsoft (R) 文件扩展实用程序
    版权所有 (c) Microsoft Corporation。保留所有权利。

    解压(expand):

    1.查看cab文件中压缩文件列表

    expand -d c:cab	est.cab

    2.提取cab文件中的单个文件

    expand c:cab	est.cab -f:ip2.txt .

    其中,最后的.代表当前目录,你可以自己指定。

    3.提取cab所有文件

    expand c:cab	est.cab -f:* .

    其中,-f:* 代表所有文件,可以使用通配符。最后的.代表当前目录,你可以自己指定。

     如需转载请注明出处。

  • 相关阅读:
    具体解释协方差与协方差矩阵
    百度地图SDK for Android v2.1.3全新发布
    奇妙的等式
    Canny边缘检测及C++实现
    移动火柴问题
    移动火柴问题
    奇妙的等式 && 精妙的证明(二)
    奇妙的等式 && 精妙的证明(二)
    拉马努金恒等式
    拉马努金恒等式
  • 原文地址:https://www.cnblogs.com/feiquan/p/10652686.html
Copyright © 2011-2022 走看看