windows 命令提示符 zip/compress 目录 [英] windows command promt zip/compress directory
问题描述
是否可以通过 cmd.exe 将目录及其所有子目录和文件压缩/归档到单个文件中?我知道有很多实用程序可用,但我只需要使用 Windows 默认实用程序来执行操作.我正在运行 Windows Server 2003.
Is possible to compress/archive a directory with all of its sub-directories and files in a single file from cmd.exe ? I know there are a lot of utilities available but I need to perform the operation only with the windows default utilities . I'm running windows server 2003 .
推荐答案
虽然旧的 makecab 不存储真正的目录结构,但如果您确实需要,您可以命令每个文件的输出目录.该过程比使用现代实用程序更麻烦,但可以完成.
Although the old makecab doesn't store a real directory structure, you can command the output directories for each file if you really need it. The procedure is more cumbersome than using a modern utility, but can be done.
为此,您应该创建一个 .ddf 文件.
For doing this you should create a .ddf file.
旧版 makecab 的手册已被 MS 从网上删除.我在此处找到了一份副本.
The manual for the old makecab has been removed from the web by MS. I found a copy here.
在 makecab 手册的第 33 页中,您会发现:
In page 33 of the makecab manual you will find:
DestinationDir=path
为cabinet中的每个文件存储在cabinet文件中的路径前缀.
默认:.Set DestinationDir= ;默认为无路径前缀
路径与路径分隔符(\")和目标文件名连接
文件复制命令以生成存储在cabinet文件中的文件名.
EXTRACT.EXE 将使用此文件名作为解压文件时的默认名称.
Examples:
.Set DestinationDir=SYSTEM ; Following files get SYSTEM prefix
bin\ARIAL.TTF ; Name in cabinet is SYSTEM\ARIAL.TTF
.Set DestinationDir= ; No prefix
bin\ARIAL.TTF ; Name in cabinet is ARIAL.TTF
哈!
这篇关于windows 命令提示符 zip/compress 目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!