windows命令提示zip/压缩目录
是否可以从 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 .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尽管旧的 makecab 不存储真实的目录结构,但如果确实需要,您可以命令每个文件的输出目录。该过程比使用现代实用程序更麻烦,但可以完成。
为此,您应该创建一个 .ddf 文件。
旧版 makecab 的手册已被微软从网上删除。我在此处找到了一份副本。
在 makecab 手册的第 33 页中,您将找到:
DestinationDir=path
内阁中每个文件存储在内阁文件中的路径前缀。
默认:.Set DestinationDir= ;默认没有路径前缀
路径
用路径分隔符(“\”)和目标文件名连接
文件复制命令生成存储在 Cabinet 文件中的文件名。
EXTRACT.EXE 在提取文件时将使用此文件名作为默认名称。
HTH!
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.
For doing this you should create a .ddf file.
The manual for the old makecab has been removed from the web by MS. I found a copy here.
In page 33 of the makecab manual you will find:
DestinationDir=path
Path prefix to store in cabinet file for each file in the cabinet.
Default: .Set DestinationDir= ; Default is no path prefix
path
is concatenated with a path separator (“\”) and the target file name on
File Copy Commands to produce the file name that is stored in cabinet file.
EXTRACT.EXE will use this file name as the default name when the file is extracted.
HTH!
您实际上无能为力,因为 Windows 中没有标准的命令行压缩。
我能想到的最接近的方法是使用备份程序 NTBackup 。
如果有什么方法可以安装实用程序,我强烈推荐7zip,我已经用过它了编写脚本的经验。
There's really very little you can do as there's no command-line compression as part of Windows as standard.
The closest thing I can think of is to use the backup program NTBackup.
If there's any way you can install a utility I'd strongly recommend 7zip which I've had good experience of scripting with.