当前位置: 移动技术网 > 科技>操作系统>windows > cmd实现cab文件的压缩与解压

cmd实现cab文件的压缩与解压

2019年04月04日  | 移动技术网科技  | 我要评论

德昂族图片,水位水温传感器,北京哪做双眼皮好

压缩(makecab):

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\test.cab
microsoft (r) 文件扩展实用程序
版权所有 (c) microsoft corporation。保留所有权利。

 

解压(expand):

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

expand -d c:\cab\test.cab

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

expand c:\cab\test.cab -f:ip2.txt .

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

3.提取cab所有文件

expand c:\cab\test.cab -f:* .

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

 如需转载请注明出处。

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网