使用 winrar 命令行创建 zip 存档
我使用以下 winrar 命令行来创建 zip 存档:
rar.exe a -df -ep -ag[yyyyMMddhhmmss] -ms[txt] C:\MyZipFile.zip C:\tmp\MyFiles*.txt
创建的存档采用 RAR 格式而不是 ZIP 格式。有没有办法创建常规 ZIP 而不是 RAR 存档?
I'm using the following winrar command line to create zip archives:
rar.exe a -df -ep -ag[yyyyMMddhhmmss] -ms[txt] C:\MyZipFile.zip C:\tmp\MyFiles*.txt
The archives created are in RAR format instead of ZIP. Is there a way to create regular ZIP and not RAR archives?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
确保您使用的是 WinRAR.exe 而不是 Rar.exe。
如果您使用命令行来执行此操作,请确保输入:
not:
It Works for me。我也让它在 SSIS 中工作。
Make certain you are using WinRAR.exe and not Rar.exe.
If you are using the command line to do this make sure you type:
not:
It works for me. I also got it to work in SSIS.
WinRAR 在其帮助文件(WinRAR 帮助)的“命令行语法”一章中有对其命令行语法的详细说明。
所有命令,例如“a”(添加到存档)、“d”(从存档中删除)、“e”(从存档中提取,忽略路径)以及诸如“-af”(指定是否创建存档)等开关此处列出了 (.rar 或 zip 文件)、“-ad”(将存档名称附加到目标路径)或“-p”(使用密码保护对存档进行加密)。
有很多选择。我建议在通过命令行使用 WinRAR 时阅读命令行语法规则。
为了从 MS Access 数据库应用程序中触发 WinRAR zip 打包,我在 VBA 代码中使用,例如
当然,文件路径和名称通常通过变量输入,例如
“然后只需通过以下方式调用 Winrar:
WinRAR has a detailed description of its command line syntax in its help files (WinRAR Help), chapter "Command line syntax".
All the commands such as "a" (add to an archive), "d" (delete from an archive), "e" (extract from an archive ignoring paths) and switches such as "-af" (specify whether to create a rar or a zip file), "-ad" (append archive name to destination path) or "-p" (encrypt the archive using password protection) are listed there.
There are quite a lot of options. I recommend reading the command line syntax rules when working with WinRAR via command lines.
In order to trigger WinRAR zip-packaging from within a MS Access database application, I use in the VBA code for example
Of course, the file paths and names are ususally entered via variables, e.g. like
'And then call Winrar simply by:
所以rar.exe目前无法自行创建zip文件,只有在Windows版本中调用才可能。
So rar.exe is currently unable to create zip files by itself only by calling in the Windows version it is possible.